public abstract class AbstractPartOfSpeechTags extends IsCloseableObject implements PartOfSpeechTags, IsCloseable
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
generalTagNames
Tag to general tag name map.
|
protected java.util.Map<java.lang.String,PartOfSpeech> |
partOfSpeechData
Stores information about part of speech tags.
|
protected char |
tagSeparator
Character separating multiple part of speech tags.
|
protected java.lang.String |
tagSeparatorString |
ADJECTIVE, ADVERB, CARDINAL_NUMERAL, DESCRIPTION_INDEX, ENGLISH_WORD, FOREIGN_WORD, FRENCH_WORD, GENERAL_TAG_NAME_INDEX, GERMAN_WORD, GREEK_WORD, HEBREW_WORD, INTERJECTION, ITALIAN_WORD, LATIN_WORD, MAJOR_WORDCLASS_INDEX, NONE, ORDINAL_NUMERAL, PLURAL_NOUN, PLURAL_PROPER_NOUN, POSSESSIVE_NOUN, POSSESSIVE_PLURAL_NOUN, POSSESSIVE_PLURAL_PROPER_NOUN, POSSESSIVE_SINGULAR_NOUN, POSSESSIVE_SINGULAR_PROPER_NOUN, PROPER_NOUN, PUNCTUATION, SINGULAR_NOUN, SINGULAR_PROPER_NOUN, SPANISH_WORD, SYMBOL, TAG_INDEX, UNDETERMINED, VERB, VERB_PAST, VERB_PAST_PARTICIPLE, VERB_PRESENT_PARTICIPLE, WORDCLASS_INDEX
Constructor and Description |
---|
AbstractPartOfSpeechTags() |
Modifier and Type | Method and Description |
---|---|
void |
addPartOfSpeech(PartOfSpeech partOfSpeech)
Add a part of speech.
|
void |
addTag(java.lang.String tag,
java.lang.String wordClass,
java.lang.String majorWordClass,
java.lang.String lemmaWordClass,
java.lang.String generalTagName,
java.lang.String description)
Add a part of speech tag.
|
int |
countTags(java.lang.String tag)
Get number of tags comprising this tag.
|
java.lang.String |
getAdjectiveTag()
Get the part of speech tag for an adjective.
|
java.lang.String |
getAdverbTag()
Get the part of speech tag for an adverb.
|
java.lang.String |
getCardinalNumberTag()
Get the part of speech tag for a cardinal number.
|
java.lang.String |
getCorrespondingCommonNounTag(java.lang.String tag)
Convert proper noun tag to common noun tag.
|
java.lang.String |
getDescription(java.lang.String tag)
Get the description for the part of speech.
|
java.lang.String |
getForeignWordTag(java.lang.String language)
Get the part of speech tag for a specified foreign language
|
java.lang.String |
getInterjectionTag()
Get the part of speech tag for an interjection.
|
java.lang.String |
getLemmaWordClass(java.lang.String tag)
Get lemma class for a tag.
|
java.lang.String |
getMajorWordClass(java.lang.String tag)
Get major word class for a tag.
|
java.lang.String |
getOrdinalNumberTag()
Get the part of speech tag for an ordinal number.
|
protected PartOfSpeech |
getPartOfSpeechData(java.lang.String tag)
Get part of speech data for a tag.
|
java.lang.String |
getPastParticipleTag()
Get the part of speech tag for a verbal past participle
|
java.lang.String |
getPluralNounTag()
Get the part of speech tag for a plural noun.
|
java.lang.String |
getPluralProperNounTag()
Get the part of speech tag for a plural proper noun.
|
java.lang.String |
getPossessivePluralNounTag()
Get the part of speech tag for a possessive plural noun.
|
java.lang.String |
getPossessivePluralProperNounTag()
Get the part of speech tag for a possessive plural proper noun.
|
java.lang.String |
getPossessiveSingularNounTag()
Get the part of speech tag for a possessive singular noun.
|
java.lang.String |
getPossessiveSingularProperNounTag()
Get the part of speech tag for a possessive singular proper noun.
|
java.lang.String |
getPresentParticipleTag()
Get the part of speech tag for a verbal present participle
|
java.lang.String |
getSingularNounTag()
Get the part of speech tag for a singular noun.
|
java.lang.String |
getSingularProperNounTag()
Get the part of speech tag for a singular proper noun.
|
java.lang.String |
getSymbolTag()
Get the part of speech tag for a symbol.
|
PartOfSpeech |
getTag(java.lang.String tag)
Get data for a tag.
|
java.util.Set<java.lang.String> |
getTagNames()
Return set of tag names.
|
java.util.List<PartOfSpeech> |
getTags()
Get list of tag entries in PartOfSpeech format.
|
java.lang.String |
getTagSeparator()
Get part of speech separator.
|
java.lang.String |
getUndeterminedTag()
Get undetermined part of speech tag.
|
java.lang.String |
getVerbPastTag()
Get the part of speech tag for a verb past tense.
|
java.lang.String |
getVerbTag()
Get the part of speech tag for a verb.
|
java.lang.String |
getWordClass(java.lang.String tag)
Get word class for a tag.
|
boolean |
isCompoundTag(java.lang.String tag)
Check of specified tag contains more than one part of speech.
|
boolean |
isDeterminerTag(java.lang.String tag)
Is tag for a determiner.
|
boolean |
isForeignWordTag(java.lang.String tag)
Is tag for a foreign word.
|
boolean |
isInterjectionTag(java.lang.String tag)
Check if specified tag is an interjection.
|
boolean |
isNounTag(java.lang.String tag)
Is tag for a noun.
|
boolean |
isNumberTag(java.lang.String tag)
Is tag for a number.
|
boolean |
isPersonalPronounTag(java.lang.String tag)
Is tag for a personal pronoun.
|
boolean |
isPronounTag(java.lang.String tag)
Is tag for a pronoun.
|
boolean |
isProperAdjectiveTag(java.lang.String tag)
Is tag for a proper adjective.
|
boolean |
isProperNounTag(java.lang.String tag)
Is tag for a proper noun.
|
boolean |
isPunctuationTag(java.lang.String tag)
Is tag for punctuation.
|
boolean |
isSingularNounTag(java.lang.String tag)
Is tag for a singular noun.
|
boolean |
isSymbolTag(java.lang.String tag)
Is tag for a symbol.
|
boolean |
isTag(java.lang.String tag)
Check if specified tag appears in the tag list.
|
boolean |
isUndeterminedTag(java.lang.String tag)
Is part of speech tag undetermined.
|
boolean |
isVerbTag(java.lang.String tag)
Is tag for a verb.
|
java.lang.String |
joinTags(java.lang.String[] tags)
Join separate tags into a compound tag..
|
java.lang.String |
joinTags(java.lang.String[] tags,
java.lang.String separator)
Join separate tags into a compound tag..
|
void |
loadTags(java.io.InputStream tagsInputStream,
java.lang.String encoding)
Load part of speech tags.
|
boolean |
majorWordClassEquals(java.lang.String tag,
java.lang.String majorWordClass)
Check if major word class is a specified value.
|
void |
saveTags(java.lang.String fileName)
Save part of speech tags to* a properties file.
|
java.lang.String[] |
splitTag(java.lang.String tag)
Split compound tag into separate tags.
|
java.lang.String |
toString()
Return string form of tag set.
|
close
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close
protected java.util.Map<java.lang.String,PartOfSpeech> partOfSpeechData
Maps part of speech tags to tag information.
protected java.util.Map<java.lang.String,java.lang.String> generalTagNames
protected char tagSeparator
protected java.lang.String tagSeparatorString
public void addTag(java.lang.String tag, java.lang.String wordClass, java.lang.String majorWordClass, java.lang.String lemmaWordClass, java.lang.String generalTagName, java.lang.String description)
addTag
in interface PartOfSpeechTags
tag
- Tag name.wordClass
- The word class.majorWordClass
- The major word class.lemmaWordClass
- The lemma word class.generalTagName
- The general tag name.description
- The description.public void addPartOfSpeech(PartOfSpeech partOfSpeech)
addPartOfSpeech
in interface PartOfSpeechTags
partOfSpeech
- The part of speech to add.public void loadTags(java.io.InputStream tagsInputStream, java.lang.String encoding) throws java.io.IOException
tagsInputStream
- Input stream for part of speech tags
information.encoding
- Character encoding for stream.java.io.IOException
- When input stream cannot be read.public void saveTags(java.lang.String fileName) throws java.io.IOException
fileName
- Output file name.java.io.IOException
- When input stream cannot be read.protected PartOfSpeech getPartOfSpeechData(java.lang.String tag)
tag
- The part of speech tag.public java.lang.String getSingularNounTag()
getSingularNounTag
in interface PartOfSpeechTags
public java.lang.String getPluralNounTag()
getPluralNounTag
in interface PartOfSpeechTags
public java.lang.String getPossessiveSingularNounTag()
getPossessiveSingularNounTag
in interface PartOfSpeechTags
public java.lang.String getPossessivePluralNounTag()
getPossessivePluralNounTag
in interface PartOfSpeechTags
public java.lang.String getSingularProperNounTag()
getSingularProperNounTag
in interface PartOfSpeechTags
public java.lang.String getPluralProperNounTag()
getPluralProperNounTag
in interface PartOfSpeechTags
public java.lang.String getPossessiveSingularProperNounTag()
getPossessiveSingularProperNounTag
in interface PartOfSpeechTags
public java.lang.String getPossessivePluralProperNounTag()
getPossessivePluralProperNounTag
in interface PartOfSpeechTags
public java.lang.String getCardinalNumberTag()
getCardinalNumberTag
in interface PartOfSpeechTags
public java.lang.String getOrdinalNumberTag()
getOrdinalNumberTag
in interface PartOfSpeechTags
public java.lang.String getAdverbTag()
getAdverbTag
in interface PartOfSpeechTags
public java.lang.String getAdjectiveTag()
getAdjectiveTag
in interface PartOfSpeechTags
public java.lang.String getInterjectionTag()
getInterjectionTag
in interface PartOfSpeechTags
public java.lang.String getVerbTag()
getVerbTag
in interface PartOfSpeechTags
public java.lang.String getVerbPastTag()
getVerbPastTag
in interface PartOfSpeechTags
public java.lang.String getPastParticipleTag()
getPastParticipleTag
in interface PartOfSpeechTags
public java.lang.String getPresentParticipleTag()
getPresentParticipleTag
in interface PartOfSpeechTags
public java.lang.String getSymbolTag()
getSymbolTag
in interface PartOfSpeechTags
public java.lang.String getForeignWordTag(java.lang.String language)
getForeignWordTag
in interface PartOfSpeechTags
language
- The foreign language.public java.lang.String getDescription(java.lang.String tag)
getDescription
in interface PartOfSpeechTags
tag
- The part of speech tag.public java.lang.String getWordClass(java.lang.String tag)
getWordClass
in interface PartOfSpeechTags
tag
- The part of speech tag.public java.lang.String getMajorWordClass(java.lang.String tag)
getMajorWordClass
in interface PartOfSpeechTags
tag
- The part of speech tag.public java.lang.String getLemmaWordClass(java.lang.String tag)
getLemmaWordClass
in interface PartOfSpeechTags
tag
- The part of speech tag.public java.lang.String getCorrespondingCommonNounTag(java.lang.String tag)
getCorrespondingCommonNounTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean majorWordClassEquals(java.lang.String tag, java.lang.String majorWordClass)
tag
- The part of speech tag.majorWordClass
- Major word class to check,public java.lang.String getUndeterminedTag()
getUndeterminedTag
in interface PartOfSpeechTags
public boolean isProperNounTag(java.lang.String tag)
isProperNounTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean isProperAdjectiveTag(java.lang.String tag)
isProperAdjectiveTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean isNounTag(java.lang.String tag)
isNounTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean isSingularNounTag(java.lang.String tag)
isSingularNounTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean isPronounTag(java.lang.String tag)
isPronounTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean isPersonalPronounTag(java.lang.String tag)
isPersonalPronounTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean isVerbTag(java.lang.String tag)
isVerbTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean isDeterminerTag(java.lang.String tag)
isDeterminerTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean isForeignWordTag(java.lang.String tag)
isForeignWordTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public java.util.List<PartOfSpeech> getTags()
getTags
in interface PartOfSpeechTags
public boolean isNumberTag(java.lang.String tag)
isNumberTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean isSymbolTag(java.lang.String tag)
isSymbolTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean isPunctuationTag(java.lang.String tag)
isPunctuationTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean isTag(java.lang.String tag)
isTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean isCompoundTag(java.lang.String tag)
isCompoundTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public boolean isUndeterminedTag(java.lang.String tag)
isUndeterminedTag
in interface PartOfSpeechTags
tag
- Tag to check for being undetermined.public boolean isInterjectionTag(java.lang.String tag)
isInterjectionTag
in interface PartOfSpeechTags
tag
- The part of speech tagpublic java.lang.String getTagSeparator()
getTagSeparator
in interface PartOfSpeechTags
public java.lang.String joinTags(java.lang.String[] tags, java.lang.String separator)
joinTags
in interface PartOfSpeechTags
tags
- String array of part of speech tags.separator
- String to separate tags.public java.lang.String joinTags(java.lang.String[] tags)
joinTags
in interface PartOfSpeechTags
tags
- String array of part of speech tags.public java.lang.String[] splitTag(java.lang.String tag)
splitTag
in interface PartOfSpeechTags
tag
- The part of speech tag.public int countTags(java.lang.String tag)
countTags
in interface PartOfSpeechTags
tag
- The part of speech tag.public PartOfSpeech getTag(java.lang.String tag)
getTag
in interface PartOfSpeechTags
tag
- The tag name.public java.util.Set<java.lang.String> getTagNames()
public java.lang.String toString()
toString
in class java.lang.Object