Package opennlp.tools.postag
Klasse POSDictionary
java.lang.Object
opennlp.tools.postag.POSDictionary
- Alle implementierten Schnittstellen:
Iterable<String>,MutableTagDictionary,TagDictionary,SerializableArtifact
public class POSDictionary
extends Object
implements Iterable<String>, MutableTagDictionary, SerializableArtifact
Provides a means of determining which tags are valid for a particular word
based on a
TagDictionary read from a file.-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungInitializes an empty case sensitivePOSDictionary.POSDictionary(boolean caseSensitive) Initializes an emptyPOSDictionary. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic POSDictionarycreate(InputStream in) Creates a newPOSDictionaryfrom anInputStream.booleanClass<?> Retrieves the class which can serialize and recreate this artifact.String[]Returns a list of valid tags for the specifiedword.inthashCode()booleanWhether the dictionary is case-sensitive or not.iterator()Retrieves anIteratorover all words in the dictionary.String[]Associates the specified tags with the specified word.voidserialize(OutputStream out) Writes thePOSDictionaryto the givenOutputStream;toString()Von Schnittstelle geerbte Methoden java.lang.Iterable
forEach, spliterator
-
Konstruktordetails
-
POSDictionary
public POSDictionary()Initializes an empty case sensitivePOSDictionary. -
POSDictionary
public POSDictionary(boolean caseSensitive) Initializes an emptyPOSDictionary.- Parameter:
caseSensitive-trueif thePOSDictionaryis case sensitive,falseotherwise.
-
-
Methodendetails
-
getTags
Returns a list of valid tags for the specifiedword.- Angegeben von:
getTagsin SchnittstelleTagDictionary- Parameter:
word- The word.- Gibt zurück:
- An array of valid tags for the specified word or
nullif no information is available for that word.
-
iterator
Retrieves anIteratorover all words in the dictionary. -
serialize
Writes thePOSDictionaryto the givenOutputStream;After the serialization is finished the provided
OutputStreamremains open.- Parameter:
out- theOutputStreamto write the dictionary into.- Löst aus:
IOException- Throw if writing to theOutputStreamfails
-
hashCode
public int hashCode() -
equals
-
toString
-
create
Creates a newPOSDictionaryfrom anInputStream.After creation is finished the provided
InputStreamis closed.- Parameter:
in- TheInputStreamused for creating thePOSDictionary. The stream must be open and have bytes available to read from.- Gibt zurück:
- A valid
POSDictionaryinstance. - Löst aus:
IOException- Thrown if IO errors occurred during creation.InvalidFormatException- Thrown if the entries don't have exactly one token.
-
put
Beschreibung aus Schnittstelle kopiert:MutableTagDictionaryAssociates the specified tags with the specified word. If the dictionary previously contained keys for the word, the old tags are replaced by the specified tags.- Angegeben von:
putin SchnittstelleMutableTagDictionary- Parameter:
word- word with which the specified tags is to be associatedtags- tags to be associated with the specified word- Gibt zurück:
- the previous tags associated with the word, or null if there was no mapping for word.
-
isCaseSensitive
public boolean isCaseSensitive()Beschreibung aus Schnittstelle kopiert:TagDictionaryWhether the dictionary is case-sensitive or not.- Angegeben von:
isCaseSensitivein SchnittstelleTagDictionary- Gibt zurück:
trueif the dictionary is case-sensitive, elsefalse.
-
getArtifactSerializerClass
Beschreibung aus Schnittstelle kopiert:SerializableArtifactRetrieves the class which can serialize and recreate this artifact.Note: The serializer class must have a
public zero argument constructoror an exception is thrown during model serialization/loading.- Angegeben von:
getArtifactSerializerClassin SchnittstelleSerializableArtifact- Gibt zurück:
- The corresponding
ArtifactSerializerclass.
-