001package org.dllearner.algorithms.isle.wsd;
002
003import org.dllearner.algorithms.isle.index.Annotation;
004import org.dllearner.algorithms.isle.index.EntityScorePair;
005import org.dllearner.algorithms.isle.index.SemanticAnnotation;
006import org.semanticweb.owlapi.model.OWLOntology;
007
008import java.util.Set;
009
010/**
011 * Abstract class for the word sense disambiguation component.
012 *
013 * @author Daniel Fleischhacker
014 */
015public abstract class WordSenseDisambiguation {
016    OWLOntology ontology;
017
018    /**
019     * Initializes the word sense disambiguation to use the given ontology.
020     *
021     * @param ontology the ontology to disambiguate on
022     */
023    public WordSenseDisambiguation(OWLOntology ontology) {
024        this.ontology = ontology;
025    }
026
027    /**
028     * Chooses the correct entity for the given annotation from a set of candidate entities.
029     *
030     *
031     * @param annotation        the annotation to find entity for
032     * @param candidateEntities the set of candidate entities
033     * @return semantic annotation containing the given annotation and the chosen entity
034     */
035    public abstract SemanticAnnotation disambiguate(Annotation annotation, Set<EntityScorePair> candidateEntities);
036}