Class PartOfSpeech
- java.lang.Object
-
- com.gengoai.hermes.morphology.PartOfSpeech
-
- All Implemented Interfaces:
Tag
,Serializable
public final class PartOfSpeech extends Object implements Tag, Serializable
Interface defining a part-of-speech. A part-of-speech has an associated name representing a human-readable label, a tag which is used in annotated corpora, and a
UniversalFeatureSet
set relating to the features the tag invokes.Out-of-the-box Hermes provides the Universal and Penn Treebank tag sets. New tags can be created by calling
create(String, String, PartOfSpeech, boolean, Tuple2[])
, which will register the tag. Note: It is important that name and tag are unique. In the case where a pos tag would have the same name or tag value, it should reuse an existing tag when compatible or prefix the name and tag with a tag set identifier, e.g. if we want a tag with the name "NN" and it does not correspond to the Penn Treebank tag, we could prefix with tag set identifier, like "myNN". Note: This means your training and testing corpora will need to be modified to include the prefix.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static PartOfSpeech
ADJECTIVE
static PartOfSpeech
ADPOSITION
static PartOfSpeech
ADVERB
static PartOfSpeech
ANY
static PartOfSpeech
AUXILIARY
static PartOfSpeech
CCONJ
static PartOfSpeech
DETERMINER
static PartOfSpeech
INTERJECTION
static PartOfSpeech
NOUN
static PartOfSpeech
NUMERAL
static PartOfSpeech
OTHER
static PartOfSpeech
PARTICLE
static PartOfSpeech
PRONOUN
static PartOfSpeech
PROPER_NOUN
static PartOfSpeech
PUNCTUATION
static PartOfSpeech
SCONJ
static PartOfSpeech
SYMBOL
static PartOfSpeech
VERB
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PartOfSpeech
create(String name, String tag, @NonNull PartOfSpeech parent, boolean isPhraseTag, Tuple2<UniversalFeature,UniversalFeatureValue>... features)
boolean
equals(Object o)
static PartOfSpeech
forText(@NonNull HString text)
Determines the best fundamental POS (NOUN, VERB, ADJECTIVE, or ADVERB) for a text.PartOfSpeech
getUniversalTag()
int
hashCode()
boolean
isAdjective()
boolean
isAdposition()
boolean
isAdverb()
boolean
isAuxiliary()
boolean
isCoordinatingConjunction()
boolean
isDeterminer()
boolean
isInstance(@NonNull Tag tag)
boolean
isInterjection()
boolean
isNoun()
boolean
isNumeral()
boolean
isParticle()
boolean
isPronoun()
boolean
isProperNoun()
boolean
isPunctuation()
boolean
isSubordinationConjunction()
boolean
isSymbol()
boolean
isUniversalTag()
boolean
isVerb()
String
name()
PartOfSpeech
parent()
protected Object
readResolve()
String
tag()
String
toString()
static PartOfSpeech
valueOf(String nameOrTag)
Gets the PartOfSpeech from the given name or tagstatic Collection<PartOfSpeech>
values()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.gengoai.Tag
isInstance, label
-
-
-
-
Field Detail
-
ANY
public static final PartOfSpeech ANY
-
ADJECTIVE
public static final PartOfSpeech ADJECTIVE
-
ADPOSITION
public static final PartOfSpeech ADPOSITION
-
ADVERB
public static final PartOfSpeech ADVERB
-
AUXILIARY
public static final PartOfSpeech AUXILIARY
-
CCONJ
public static final PartOfSpeech CCONJ
-
DETERMINER
public static final PartOfSpeech DETERMINER
-
INTERJECTION
public static final PartOfSpeech INTERJECTION
-
NOUN
public static final PartOfSpeech NOUN
-
NUMERAL
public static final PartOfSpeech NUMERAL
-
OTHER
public static final PartOfSpeech OTHER
-
PARTICLE
public static final PartOfSpeech PARTICLE
-
PRONOUN
public static final PartOfSpeech PRONOUN
-
PROPER_NOUN
public static final PartOfSpeech PROPER_NOUN
-
PUNCTUATION
public static final PartOfSpeech PUNCTUATION
-
SCONJ
public static final PartOfSpeech SCONJ
-
SYMBOL
public static final PartOfSpeech SYMBOL
-
VERB
public static final PartOfSpeech VERB
-
-
Method Detail
-
create
@SafeVarargs public static PartOfSpeech create(String name, String tag, @NonNull @NonNull PartOfSpeech parent, boolean isPhraseTag, Tuple2<UniversalFeature,UniversalFeatureValue>... features)
-
forText
public static PartOfSpeech forText(@NonNull @NonNull HString text)
Determines the best fundamental POS (NOUN, VERB, ADJECTIVE, or ADVERB) for a text.- Parameters:
text
- The text- Returns:
- The part of speech
-
valueOf
public static PartOfSpeech valueOf(String nameOrTag)
Gets the PartOfSpeech from the given name or tag- Parameters:
nameOrTag
- the name or tag of the PartOfSpeech we want- Returns:
- the PartOfSpeech
-
values
public static Collection<PartOfSpeech> values()
- Returns:
- All known and registered PartOfSpeech tags
-
getUniversalTag
public PartOfSpeech getUniversalTag()
- Returns:
- The Universal PartOfSpeech this PartOfSpeech maps to
-
isAdjective
public boolean isAdjective()
- Returns:
- True if this PartOfSpeech is an Adjective
-
isAdposition
public boolean isAdposition()
- Returns:
- True if this PartOfSpeech is an Adposition
-
isAdverb
public boolean isAdverb()
- Returns:
- True if this PartOfSpeech is an Adverb
-
isAuxiliary
public boolean isAuxiliary()
- Returns:
- True if this PartOfSpeech is an Auxiliary
-
isCoordinatingConjunction
public boolean isCoordinatingConjunction()
- Returns:
- True if this PartOfSpeech is a Coordinating Conjunction
-
isDeterminer
public boolean isDeterminer()
- Returns:
- True if this PartOfSpeech is a Determiner
-
isInstance
public boolean isInstance(@NonNull @NonNull Tag tag)
- Specified by:
isInstance
in interfaceTag
-
isInterjection
public boolean isInterjection()
- Returns:
- True if this PartOfSpeech is an Interjection
-
isNoun
public boolean isNoun()
- Returns:
- True if this PartOfSpeech is a Noun
-
isNumeral
public boolean isNumeral()
- Returns:
- True if this PartOfSpeech is a Numeral
-
isParticle
public boolean isParticle()
- Returns:
- True if this PartOfSpeech is a Particle
-
isPronoun
public boolean isPronoun()
- Returns:
- True if this PartOfSpeech is a Pronoun
-
isProperNoun
public boolean isProperNoun()
- Returns:
- True if this PartOfSpeech is a Proper Noun
-
isPunctuation
public boolean isPunctuation()
- Returns:
- True if this PartOfSpeech is a Punctuation
-
isSubordinationConjunction
public boolean isSubordinationConjunction()
- Returns:
- True if this PartOfSpeech is a Subordination Conjunction
-
isSymbol
public boolean isSymbol()
- Returns:
- True if this PartOfSpeech is a Symbol
-
isUniversalTag
public boolean isUniversalTag()
- Returns:
- True if this PartOfSpeech represents a Universal POS tag.
-
isVerb
public boolean isVerb()
- Returns:
- True if this PartOfSpeech is a verb
-
parent
public PartOfSpeech parent()
-
readResolve
protected Object readResolve() throws ObjectStreamException
- Throws:
ObjectStreamException
-
tag
public String tag()
- Returns:
- the tag form of the PartOfSpeech
-
-