Package it.uniroma1.lcl.babelnet
Class BabelSense
- java.lang.Object
-
- it.uniroma1.lcl.babelnet.BabelSense
-
- Direct Known Subclasses:
WordNetSense
public class BabelSense extends Object implements Sense
A sense inBabelNet
, contained in aBabelSynset
.- Author:
- navigli, ponzetto
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BabelSense.Builder
The Builder of aBabelSense
.
-
Field Summary
Fields Modifier and Type Field Description protected String
fullLemma
The full lemma for this senseprotected it.uniroma1.lcl.jlt.util.Language
language
The language of this senseprotected BabelLemma
lemma
The BabelLemma for this senseprotected it.uniroma1.lcl.jlt.util.POS
pos
The part-of-speech of this senseprotected String
senseKey
The sensekey of the OmegaWiki, Wikidata, Wiktionary, GeoName, MSTERM or VerbNet sense to which this sense corresponds, if anyprotected String
simpleLemma
The simple lemma for this sense (without parentheses, etc.)protected BabelSenseSource
source
The source of this lemma: WordNet, Wikipedia, translation, etc.protected BabelSynset
synset
The synset this sense belongs toprotected BabelSynsetID
synsetID
The synset id this sense belongs to
-
Constructor Summary
Constructors Modifier Constructor Description 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 aBabelSense
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(Object obj)
String
getDBPediaURI()
Deprecated.String
getFrameNetURI()
Deprecated.Integer
getFrequency()
Deprecated.DiscontinuedString
getFullLemma()
Gets the full lemma of thisSense
(which might include annotations, such as labels in Wikipedia page titles).String
getGeoNamesURI()
Deprecated.Collection<BabelGloss>
getGlosses()
Returns theBabelGloss
es associated to thisSense
.int
getID()
Gets the numeric id of the sense.it.uniroma1.lcl.jlt.util.Language
getLanguage()
Gets theLanguage
of thisSense
BabelLemma
getLemma()
Gets the lemma of thisSense
.BabelLicense
getLicense()
Returns the license for this Babel senseString
getNormalizedLemma()
Gets the normalized lemma of thisSense
.it.uniroma1.lcl.jlt.util.POS
getPOS()
Gets the part of speech of thisSense
.Integer
getPosition()
Deprecated.Moved toWordNetSense
BabelSensePhonetics
getPronunciations()
Returns the pronunciationsString
getSensekey()
Gets the sensekey of the WordNet, Omega, Wikidata or Wiktionary sense to which thisBabelSense
corresponds, if any.int
getSenseNumber()
Deprecated.Moved toWordNetSense
String
getSenseString()
Deprecated.Please usegetSensekey()
BabelSenseTranslationInfo
getSenseTranslationInfo()
Deprecated.To be removed in the next API releaseString
getSimpleLemma()
Deprecated.BabelSenseSource
getSource()
Gets theBabelSenseSource
of thisSense
.BabelSynset
getSynset()
Gets theBabelSynset
thisSense
belongs to.BabelSynsetID
getSynsetID()
Returns the id of theSynset
the sense belongs toCollection<Tag>
getTags()
<T extends Tag>
Collection<T>getTags(Class<T> classTag)
Returns the collection of the given class of thisTaggable
.String
getVerbNetURI()
Deprecated.Optional<String>
getWordNetOffset()
Deprecated.Moved toWordNetSense
String
getYAGOURI()
Deprecated.int
hashCode()
boolean
isAutomaticTranslation()
Returns true if the sense is the result of an automatic translationboolean
isKeyConcept()
Deprecated.Use {@link BabelSense:isKeySense()} insteadboolean
isKeySense()
Returns true if it is a key senseboolean
isNotAutomaticTranslation()
Returns true if the sense is NOT the result of an automatic translationboolean
isTaggedAs(Tag tag)
Checks if the given tag are contained in thisTaggable
.boolean
isTaggedAs(Tag... tags)
Checks if all the given tags are contained in thisTaggable
.boolean
isTaggedAs(Collection<Tag> tags)
Checks if all the given tags are contained in thisTaggable
.String
toString()
Optional<String>
toURI(ExternalResource resource)
Returns the URI of the sense for a givenExternalResource
-
-
-
Field Detail
-
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 Detail
-
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 aBabelSense
- Parameters:
language
- the language of the senselemma
- the lemma of the sensesimpleLemma
- the simple lemma of the sensepos
- the part of speech of the sensesource
- the source of the sensesensekey
- the sense keysynset
- the synset the sense belongs to
-
-
Method Detail
-
getID
public int getID()
Gets the numeric id of the sense. Please usegetSensekey()
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 {@link BabelSense: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 interfaceSense
- Returns:
- true if it is a key sense, false otherwise
-
getFullLemma
public String getFullLemma()
Description copied from interface:Sense
Gets the full lemma of thisSense
(which might include annotations, such as labels in Wikipedia page titles). UseSense.getNormalizedLemma()
to retrieve plain lemmas lower case orSense.getLemma()
.- Specified by:
getFullLemma
in interfaceSense
- Returns:
- the lemma of this
Sense
.
-
getSimpleLemma
@Deprecated public String getSimpleLemma()
Deprecated.Description copied from interface:Sense
Gets the simple lemma of thisSense
. 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 interfaceSense
- Returns:
- the simple lemma of this
Sense
.
-
getNormalizedLemma
public String getNormalizedLemma()
Description copied from interface:Sense
Gets the normalized lemma of thisSense
. 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 interfaceSense
- Returns:
- the normalized lemma of this
Sense
.
-
getLemma
public BabelLemma getLemma()
Description copied from interface:Sense
Gets the lemma of thisSense
.
-
getPOS
public it.uniroma1.lcl.jlt.util.POS getPOS()
Description copied from interface:Sense
Gets the part of speech of thisSense
.
-
getSource
public BabelSenseSource getSource()
Description copied from interface:Sense
Gets theBabelSenseSource
of thisSense
.- Specified by:
getSource
in interfaceSense
- Returns:
- the
BabelSenseSource
of thisSense
.
-
getLanguage
public it.uniroma1.lcl.jlt.util.Language getLanguage()
Description copied from interface:Sense
Gets theLanguage
of thisSense
- Specified by:
getLanguage
in interfaceSense
- Returns:
- the
Language
of thisSense
.
-
getSynset
public BabelSynset getSynset()
Description copied from interface:Sense
Gets theBabelSynset
thisSense
belongs to.- Specified by:
getSynset
in interfaceSense
- Returns:
- the
BabelSynset
of thisSense
.
-
getSensekey
public String getSensekey()
Gets the sensekey of the WordNet, Omega, Wikidata or Wiktionary sense to which thisBabelSense
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 toWordNetSense
Gets the WordNet offset of the WordNet sense to which thisBabelSense
corresponds, if any.- Returns:
- the offset of the WordNet sense corresponding to this
BabelSense
.
-
getPosition
@Deprecated public Integer getPosition()
Deprecated.Moved toWordNetSense
Gets the WordNet position of the WordNet sense to which thisBabelSense
corresponds, if any.- Returns:
- the position of the WordNet sense corresponding to this
BabelSense
.
-
getFrequency
@Deprecated public Integer getFrequency()
Deprecated.DiscontinuedGets the frequency score for thisBabelSense
. 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 releaseGets translation-related information about thisBabelSense
.- 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 theSynset
the sense belongs to- Specified by:
getSynsetID
in interfaceSense
- 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 givenExternalResource
-
getDBPediaURI
@Deprecated public String getDBPediaURI()
Deprecated.Get a link to the corresponding DBPedia URI (emptyString
if no interlinking is available or possible)- Returns:
- a link to the corresponding DBPedia URI.
- See Also:
- DBPedia interlinking
-
getYAGOURI
@Deprecated public String getYAGOURI()
Deprecated.Get a link to the corresponding YAGO URI (emptyString
if no interlinking is available or possible)- Returns:
- a link to the corresponding YAGO URI.
- See Also:
- YAGO
-
getGeoNamesURI
@Deprecated public String getGeoNamesURI()
Deprecated.Get a link to the corresponding GeoNames URI (emptyString
if no interlinking is available or possible)- Returns:
- a link to the corresponding GeoNames URI.
- See Also:
- GeoNames
-
getFrameNetURI
@Deprecated public String getFrameNetURI()
Deprecated.Get a link to the corresponding FremaNet URI (emptyString
if no interlinking is available or possible)- Returns:
- a link to the corresponding FrameNet URI.
- See Also:
- FrameNet
-
getVerbNetURI
@Deprecated public String getVerbNetURI()
Deprecated.Get a link to the corresponding VerbNet URI (emptyString
if no interlinking is available or possible)- Returns:
- a link to the corresponding VerbNet URI.
- See Also:
- VerbNet
-
getSenseString
@Deprecated public String getSenseString()
Deprecated.Please usegetSensekey()
Gets a String-based representation of thisBabelSense
alternative to the "canonical" one obtained usingtoString()
. 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 toWordNetSense
Gets the sense number of thisBabelSense
. 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 theBabelGloss
es associated to thisSense
.- Specified by:
getGlosses
in interfaceSense
- Returns:
- the
BabelGloss
es of thisSense
-
getLicense
public BabelLicense getLicense()
Returns the license for this Babel sense- Returns:
- the license
-
getTags
public Collection<Tag> getTags()
Description copied from interface:Taggable
-
getTags
public <T extends Tag> Collection<T> getTags(Class<T> classTag)
Description copied from interface:Taggable
Returns the collection of the given class of thisTaggable
.
-
isTaggedAs
public boolean isTaggedAs(Tag... tags)
Description copied from interface:Taggable
Checks if all the given tags are contained in thisTaggable
.- Specified by:
isTaggedAs
in interfaceTaggable
- 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 thisTaggable
.- Specified by:
isTaggedAs
in interfaceTaggable
- 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 thisTaggable
.- Specified by:
isTaggedAs
in interfaceTaggable
- Parameters:
tag
- the tag of interest- Returns:
- true if all the given tags are contained in this
Taggable
, false othwerwise
-
-