Class BabelSense

java.lang.Object
it.uniroma1.lcl.babelnet.BabelSense
All Implemented Interfaces:
Taggable, Sense
Direct Known Subclasses:
WordNetSense

public class BabelSense extends Object implements Sense
A sense in BabelNet, contained in a BabelSynset.
Author:
navigli, ponzetto
  • Field Details

    • fullLemma

      protected final String fullLemma
      The full lemma for this sense
    • simpleLemma

      protected final String simpleLemma
      The simple lemma for this sense (without parentheses, etc.)
    • lemma

      protected final BabelLemma lemma
      The BabelLemma for this sense
    • source

      protected final BabelSenseSource source
      The source of this lemma: WordNet, Wikipedia, translation, etc.
    • senseKey

      protected final String senseKey
      The sensekey of the OmegaWiki, Wikidata, Wiktionary, GeoName, MSTERM or VerbNet sense to which this sense corresponds, if any
    • language

      protected final it.uniroma1.lcl.jlt.util.Language language
      The language of this sense
    • pos

      protected final it.uniroma1.lcl.jlt.util.POS pos
      The part-of-speech of this sense
    • synset

      protected transient BabelSynset synset
      The synset this sense belongs to
    • synsetID

      protected final BabelSynsetID synsetID
      The synset id this sense belongs to
  • Constructor Details

    • BabelSense

      protected BabelSense(String lemma, String simpleLemma, it.uniroma1.lcl.jlt.util.Language language, it.uniroma1.lcl.jlt.util.POS pos, BabelSenseSource source, String sensekey, BabelSynset synset)
      Creates a new instance of a BabelSense
      Parameters:
      lemma - the lemma of the sense
      simpleLemma - the simple lemma of the sense
      language - the language of the sense
      pos - the part of speech of the sense
      source - the source of the sense
      sensekey - the sense key
      synset - the synset the sense belongs to
  • Method Details

    • getID

      public int getID()
      Gets the numeric id of the sense. Please use getSensekey() for a String id of the sense.
      Returns:
      the sense database identifier
    • isAutomaticTranslation

      public boolean isAutomaticTranslation()
      Returns true if the sense is the result of an automatic translation
      Returns:
      true if the sense is an automatic translation, false otherwise
    • isNotAutomaticTranslation

      public boolean isNotAutomaticTranslation()
      Returns true if the sense is NOT the result of an automatic translation
      Returns:
      true if the sense is NOT an automatic translation, false otherwise
    • isKeyConcept

      @Deprecated public boolean isKeyConcept()
      Deprecated.
      Use isKeySense() instead
      Returns:
      true if it is a key sense, false otherwise
    • isKeySense

      public boolean isKeySense()
      Description copied from interface: Sense
      Returns true if it is a key sense
      Specified by:
      isKeySense in interface Sense
      Returns:
      true if it is a key sense, false otherwise
    • getFullLemma

      public String getFullLemma()
      Description copied from interface: Sense
      Gets the full lemma of this Sense (which might include annotations, such as labels in Wikipedia page titles). Use Sense.getNormalizedLemma() to retrieve plain lemmas lower case or Sense.getLemma().
      Specified by:
      getFullLemma in interface Sense
      Returns:
      the lemma of this Sense.
    • getSimpleLemma

      @Deprecated public String getSimpleLemma()
      Deprecated.
      Description copied from interface: Sense
      Gets the simple lemma of this Sense. This corresponds to the lemma itself, if the lemma comes from WordNet, or the lemma possibly without sense labels (i.e. parentheses) if it comes from Wikipedia.
      Specified by:
      getSimpleLemma in interface Sense
      Returns:
      the simple lemma of this Sense.
    • getNormalizedLemma

      public String getNormalizedLemma()
      Description copied from interface: Sense
      Gets the normalized lemma of this Sense. This corresponds to the lower case lemma itself, if the lemma comes from WordNet, or the lower case lemma possibly without sense labels (i.e. parentheses) if it comes from Wikipedia.
      Specified by:
      getNormalizedLemma in interface Sense
      Returns:
      the normalized lemma of this Sense.
    • getLemma

      public BabelLemma getLemma()
      Description copied from interface: Sense
      Gets the lemma of this Sense.
      Specified by:
      getLemma in interface Sense
      Returns:
      the lemma of this Sense
    • getPOS

      public it.uniroma1.lcl.jlt.util.POS getPOS()
      Description copied from interface: Sense
      Gets the part of speech of this Sense.
      Specified by:
      getPOS in interface Sense
      Returns:
      the part of speech of this Sense.
    • getSource

      public BabelSenseSource getSource()
      Description copied from interface: Sense
      Gets the BabelSenseSource of this Sense.
      Specified by:
      getSource in interface Sense
      Returns:
      the BabelSenseSource of this Sense.
    • getLanguage

      public it.uniroma1.lcl.jlt.util.Language getLanguage()
      Description copied from interface: Sense
      Gets the Language of this Sense
      Specified by:
      getLanguage in interface Sense
      Returns:
      the Language of this Sense.
    • getSynset

      public BabelSynset getSynset()
      Description copied from interface: Sense
      Gets the BabelSynset this Sense belongs to.
      Specified by:
      getSynset in interface Sense
      Returns:
      the BabelSynset of this Sense.
    • getSensekey

      public String getSensekey()
      Gets the sensekey of the WordNet, Omega, Wikidata or Wiktionary sense to which this BabelSense corresponds, if any.
      Returns:
      the sensekey of the WordNet, Omega, Wikidata or Wiktionary sense corresponding to this BabelSense.
    • getWordNetOffset

      @Deprecated public Optional<String> getWordNetOffset()
      Deprecated.
      Moved to WordNetSense
      Gets the WordNet offset of the WordNet sense to which this BabelSense corresponds, if any.
      Returns:
      the offset of the WordNet sense corresponding to this BabelSense.
    • getPosition

      @Deprecated public Integer getPosition()
      Deprecated.
      Moved to WordNetSense
      Gets the WordNet position of the WordNet sense to which this BabelSense corresponds, if any.
      Returns:
      the position of the WordNet sense corresponding to this BabelSense.
    • getFrequency

      @Deprecated public Integer getFrequency()
      Deprecated.
      Discontinued
      Gets the frequency score for this BabelSense. This score represents, for a Wikipedia page/redirection, the number of its incoming links. Otherwise it is null.
      Returns:
      the frequency of this BabelSense.
    • getSenseTranslationInfo

      @Deprecated public BabelSenseTranslationInfo getSenseTranslationInfo()
      Deprecated.
      To be removed in the next API release
      Gets translation-related information about this BabelSense.
      Returns:
      translation-related information about this BabelSense.
    • getPronunciations

      public BabelSensePhonetics getPronunciations()
      Returns the pronunciations
      Returns:
      BabelSensePronunciations BabelSense
    • getSynsetID

      public BabelSynsetID getSynsetID()
      Description copied from interface: Sense
      Returns the id of the Synset the sense belongs to
      Specified by:
      getSynsetID in interface Sense
      Returns:
      SynsetID the id of the Synset the sense belongs to
    • toURI

      public Optional<String> toURI(ExternalResource resource)
      Description copied from interface: Sense
      Returns the URI of the sense for a given ExternalResource
      Specified by:
      toURI in interface Sense
      Parameters:
      resource - the external resource
      Returns:
      the URI to the external resource
    • getDBPediaURI

      @Deprecated public String getDBPediaURI()
      Deprecated.
      Get a link to the corresponding DBPedia URI (empty String if no interlinking is available or possible)
      Returns:
      a link to the corresponding DBPedia URI.
      See Also:
    • getYAGOURI

      @Deprecated public String getYAGOURI()
      Deprecated.
      Get a link to the corresponding YAGO URI (empty String if no interlinking is available or possible)
      Returns:
      a link to the corresponding YAGO URI.
      See Also:
    • getGeoNamesURI

      @Deprecated public String getGeoNamesURI()
      Deprecated.
      Get a link to the corresponding GeoNames URI (empty String if no interlinking is available or possible)
      Returns:
      a link to the corresponding GeoNames URI.
      See Also:
    • getFrameNetURI

      @Deprecated public String getFrameNetURI()
      Deprecated.
      Get a link to the corresponding FremaNet URI (empty String if no interlinking is available or possible)
      Returns:
      a link to the corresponding FrameNet URI.
      See Also:
    • getVerbNetURI

      @Deprecated public String getVerbNetURI()
      Deprecated.
      Get a link to the corresponding VerbNet URI (empty String if no interlinking is available or possible)
      Returns:
      a link to the corresponding VerbNet URI.
      See Also:
    • getSenseString

      @Deprecated public String getSenseString()
      Deprecated.
      Please use getSensekey()
      Gets a String-based representation of this BabelSense alternative to the "canonical" one obtained using toString(). This corresponds to a diesis-like representation if the sense belongs to WordNet, e.g. "car#n#1" or "funk#n#3", or the page title (with no prefix) it if corresponds to a Wikipedia sense, otherwise the lemma if it is a translation
      Returns:
      a string representing this BabelSense.
    • getSenseNumber

      @Deprecated public int getSenseNumber()
      Deprecated.
      Moved to WordNetSense
      Gets the sense number of this BabelSense. This corresponds to the sense number found in WordNet, if the sense belongs to WordNet, 0 otherwise.
      Returns:
      the sense number of this BabelSense.
    • getGlosses

      public Collection<BabelGloss> getGlosses()
      Description copied from interface: Sense
      Returns the BabelGlosses associated to this Sense.
      Specified by:
      getGlosses in interface Sense
      Returns:
      the BabelGlosses of this Sense
    • getLicense

      public BabelLicense getLicense()
      Returns the license for this Babel sense
      Returns:
      the license
    • getTags

      public Collection<Tag> getTags()
      Description copied from interface: Taggable
      Returns the collection of Tags of this Taggable.
      Specified by:
      getTags in interface Taggable
      Returns:
      the collection of Tags
    • getTags

      public <T extends Tag> Collection<T> getTags(Class<T> classTag)
      Description copied from interface: Taggable
      Returns the collection of the given class of this Taggable.
      Specified by:
      getTags in interface Taggable
      Type Parameters:
      T - the Tag type
      Parameters:
      classTag - the class for the search.
      Returns:
      the collection of the given class
    • isTaggedAs

      public boolean isTaggedAs(Tag... tags)
      Description copied from interface: Taggable
      Checks if all the given tags are contained in this Taggable.
      Specified by:
      isTaggedAs in interface Taggable
      Parameters:
      tags - the tags of interest
      Returns:
      true if all the given tags are contained in this Taggable, false othwerwise
    • isTaggedAs

      public boolean isTaggedAs(Collection<Tag> tags)
      Description copied from interface: Taggable
      Checks if all the given tags are contained in this Taggable.
      Specified by:
      isTaggedAs in interface Taggable
      Parameters:
      tags - the tags of interest
      Returns:
      true if all the given tags are contained in this Taggable, false othwerwise
    • isTaggedAs

      public boolean isTaggedAs(Tag tag)
      Description copied from interface: Taggable
      Checks if the given tag are contained in this Taggable.
      Specified by:
      isTaggedAs in interface Taggable
      Parameters:
      tag - the tag of interest
      Returns:
      true if all the given tags are contained in this Taggable, false othwerwise
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object