|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectopennlp.tools.postag.POSDictionary
public class POSDictionary
Provides a means of determining which tags are valid for a particular word based on a tag dictionary read from a file.
Constructor Summary | |
---|---|
POSDictionary()
Initializes an empty case sensitive POSDictionary . |
|
POSDictionary(boolean caseSensitive)
Initializes an empty POSDictionary . |
|
POSDictionary(BufferedReader reader,
boolean caseSensitive)
Deprecated. Use create(InputStream) instead, old format might removed. |
|
POSDictionary(String file)
Deprecated. Use create(InputStream) instead, old format might removed. |
|
POSDictionary(String file,
boolean caseSensitive)
Deprecated. Use create(InputStream) instead, old format might removed. |
|
POSDictionary(String file,
String encoding,
boolean caseSensitive)
Deprecated. Use create(InputStream) instead, old format might removed. |
Method Summary | |
---|---|
static POSDictionary |
create(InputStream in)
Creates a new POSDictionary from a provided InputStream . |
boolean |
equals(Object o)
|
String[] |
getTags(String word)
Returns a list of valid tags for the specified word. |
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()
|
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public POSDictionary()
POSDictionary
.
public POSDictionary(boolean caseSensitive)
POSDictionary
.
caseSensitive
- the POSDictionary
case sensitivity@Deprecated public POSDictionary(String file) throws IOException
create(InputStream)
instead, old format might removed.
file
- The file name for the tag dictionary.
IOException
- when the specified file can not be read.@Deprecated public POSDictionary(String file, boolean caseSensitive) throws IOException
create(InputStream)
instead, old format might removed.
file
- The file name for the tag dictionary.caseSensitive
- Specifies whether the tag dictionary is case sensitive or not.
IOException
- when the specified file can not be read.@Deprecated public POSDictionary(String file, String encoding, boolean caseSensitive) throws IOException
create(InputStream)
instead, old format might removed.
file
- The file name for the tag dictionary.encoding
- The encoding of the tag dictionary file.caseSensitive
- Specifies whether the tag dictionary is case sensitive or not.
IOException
- when the specified file can not be read.@Deprecated public POSDictionary(BufferedReader reader, boolean caseSensitive) throws IOException
create(InputStream)
instead, old format might removed.
reader
- A reader for the tag dictionary.caseSensitive
- Specifies whether the tag dictionary is case sensitive or not.
IOException
- when the specified file can not be read.Method Detail |
---|
public String[] getTags(String word)
getTags
in interface TagDictionary
word
- The word.
public Iterator<String> iterator()
iterator
in interface Iterable<String>
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 boolean equals(Object o)
equals
in class Object
public String toString()
toString
in class Object
public static POSDictionary create(InputStream in) throws IOException, InvalidFormatException
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 word
public boolean isCaseSensitive()
MutableTagDictionary
isCaseSensitive
in interface MutableTagDictionary
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |