public class POSDictionary extends Object implements Iterable<String>, MutableTagDictionary, SerializableArtifact
Constructor and Description |
---|
POSDictionary()
Initializes an empty case sensitive
POSDictionary . |
POSDictionary(boolean caseSensitive)
Initializes an empty
POSDictionary . |
Modifier and Type | Method and Description |
---|---|
static POSDictionary |
create(InputStream in)
Creates a new
POSDictionary from a provided InputStream . |
boolean |
equals(Object obj) |
Class<?> |
getArtifactSerializerClass()
Retrieves the class which can serialize and recreate this artifact.
|
String[] |
getTags(String word)
Returns a list of valid tags for the specified word.
|
int |
hashCode() |
boolean |
isCaseSensitive()
Whether if the dictionary is case sensitive or not
|
Iterator<String> |
iterator()
Retrieves an iterator over all words in the dictionary.
|
String[] |
put(String word,
String... tags)
Associates the specified tags with the specified word.
|
void |
serialize(OutputStream out)
Writes the
POSDictionary to the given OutputStream ;
After the serialization is finished the provided
OutputStream remains open. |
String |
toString() |
forEach, spliterator
public POSDictionary()
POSDictionary
.public POSDictionary(boolean caseSensitive)
POSDictionary
.caseSensitive
- the POSDictionary
case sensitivitypublic String[] getTags(String word)
getTags
in interface TagDictionary
word
- The word.public void serialize(OutputStream out) throws IOException
POSDictionary
to the given OutputStream
;
After the serialization is finished the provided
OutputStream
remains open.out
- the OutputStream
to write the dictionary into.IOException
- if writing to the OutputStream
failspublic static POSDictionary create(InputStream in) throws IOException
POSDictionary
from a provided InputStream
.
After creation is finished the provided InputStream
is closed.in
- IOException
InvalidFormatException
public String[] put(String word, String... tags)
MutableTagDictionary
put
in interface MutableTagDictionary
word
- word with which the specified tags is to be associatedtags
- tags to be associated with the specified wordpublic boolean isCaseSensitive()
MutableTagDictionary
isCaseSensitive
in interface MutableTagDictionary
public Class<?> getArtifactSerializerClass()
SerializableArtifact
getArtifactSerializerClass
in interface SerializableArtifact
Copyright © 2018 The Apache Software Foundation. All rights reserved.