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 int
static final int
private static BigramDictionary
static final char
Fields 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 int
getAvaliableIndex
(long hashId, char[] carray) private int
getBigramItemIndex
(char[] carray) int
getFrequency
(char[] carray) static BigramDictionary
private void
load()
private void
void
loadFromFile
(String dctFilePath) Load the datafile into this BigramDictionaryprivate void
loadFromInputStream
(InputStream serialObjectInputStream) private boolean
loadFromObj
(Path serialObj) private void
Methods 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:
IOException
ClassNotFoundException
-
saveToObj
- Throws:
IOException
-
load
- Throws:
IOException
ClassNotFoundException
-
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)
-