Class BigramDictionary
java.lang.Object
org.apache.lucene.analysis.cn.smart.hhmm.AbstractDictionary
org.apache.lucene.analysis.cn.smart.hhmm.BigramDictionary
SmartChineseAnalyzer Bigram dictionary.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long[]private int[]private intstatic final intprivate static BigramDictionarystatic final charFields inherited from class org.apache.lucene.analysis.cn.smart.hhmm.AbstractDictionary
CHAR_NUM_IN_FILE, GB2312_CHAR_NUM, GB2312_FIRST_CHAR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate intgetAvaliableIndex(long hashId, char[] carray) private intgetBigramItemIndex(char[] carray) intgetFrequency(char[] carray) static BigramDictionaryprivate voidload()private voidvoidloadFromFile(String dctFilePath) Load the datafile into this BigramDictionaryprivate voidloadFromInputStream(InputStream serialObjectInputStream) private booleanloadFromObj(Path serialObj) private voidMethods inherited from class org.apache.lucene.analysis.cn.smart.hhmm.AbstractDictionary
getCCByGB2312Id, getGB2312Id, hash1, hash1, hash2, hash2
-
Field Details
-
WORD_SEGMENT_CHAR
public static final char WORD_SEGMENT_CHAR- See Also:
-
singleInstance
-
PRIME_BIGRAM_LENGTH
public static final int PRIME_BIGRAM_LENGTH- See Also:
-
bigramHashTable
private long[] bigramHashTable -
frequencyTable
private int[] frequencyTable -
max
private int max
-
-
Constructor Details
-
BigramDictionary
private BigramDictionary()
-
-
Method Details
-
getInstance
-
loadFromObj
-
loadFromInputStream
private void loadFromInputStream(InputStream serialObjectInputStream) throws IOException, ClassNotFoundException - Throws:
IOExceptionClassNotFoundException
-
saveToObj
- Throws:
IOException
-
load
- Throws:
IOExceptionClassNotFoundException
-
load
- Throws:
IOException
-
loadFromFile
Load the datafile into this BigramDictionary- Parameters:
dctFilePath- path to the Bigramdictionary (bigramdict.dct)- Throws:
IOException- If there is a low-level I/O error
-
getAvaliableIndex
private int getAvaliableIndex(long hashId, char[] carray) -
getBigramItemIndex
private int getBigramItemIndex(char[] carray) -
getFrequency
public int getFrequency(char[] carray)
-