public class UserDictionary extends java.lang.Object implements Dictionary
Modifier and Type | Class and Description |
---|---|
static class |
UserDictionary.UserDictionaryMatch |
Constructor and Description |
---|
UserDictionary(java.io.InputStream inputStream,
int totalFeatures,
int readingFeature,
int partOfSpeechFeature) |
Modifier and Type | Method and Description |
---|---|
void |
addEntry(java.lang.String entry) |
java.util.List<UserDictionary.UserDictionaryMatch> |
findUserDictionaryMatches(java.lang.String text)
Lookup words in text
|
java.lang.String |
getAllFeatures(int wordId)
Gets all features of the specified word id
|
java.lang.String[] |
getAllFeaturesArray(int wordId)
Gets all features of the specified word id as a String array
|
java.lang.String |
getFeature(int wordId,
int... fields)
Gets one or more specific features of a token
|
int |
getLeftId(int wordId)
Gets the left id of the specified word
|
int |
getRightId(int wordId)
Gets the right id of the specified word
|
int |
getWordCost(int wordId)
Gets the word cost of the specified word
|
void |
read(java.io.InputStream input) |
public UserDictionary(java.io.InputStream inputStream, int totalFeatures, int readingFeature, int partOfSpeechFeature) throws java.io.IOException
java.io.IOException
public java.util.List<UserDictionary.UserDictionaryMatch> findUserDictionaryMatches(java.lang.String text)
text
- text to look up user dictionary matches forpublic int getLeftId(int wordId)
Dictionary
getLeftId
in interface Dictionary
wordId
- word id to get left id cost forpublic int getRightId(int wordId)
Dictionary
getRightId
in interface Dictionary
wordId
- word id to get right id cost forpublic int getWordCost(int wordId)
Dictionary
getWordCost
in interface Dictionary
wordId
- word id to get word cost forpublic java.lang.String[] getAllFeaturesArray(int wordId)
Dictionary
getAllFeaturesArray
in interface Dictionary
wordId
- word id to get features forpublic java.lang.String getAllFeatures(int wordId)
Dictionary
getAllFeatures
in interface Dictionary
wordId
- word id to get features forpublic java.lang.String getFeature(int wordId, int... fields)
Dictionary
This is an expert API
getFeature
in interface Dictionary
wordId
- word id to get features forfields
- array of feature ids. If this array is empty, all features are returnedpublic void read(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public void addEntry(java.lang.String entry)