Package org.lionsoul.jcseg.dic
Class HashMapDictionary
- java.lang.Object
-
- org.lionsoul.jcseg.dic.ADictionary
-
- org.lionsoul.jcseg.dic.HashMapDictionary
-
- All Implemented Interfaces:
Serializable,IDictionary
public class HashMapDictionary extends ADictionary implements Serializable
Dictionary class- Author:
- chenxin
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.lionsoul.jcseg.IDictionary
IDictionary.Type
-
-
Field Summary
Fields Modifier and Type Field Description Map<String,IWord>[]dictMaphash table for the words-
Fields inherited from class org.lionsoul.jcseg.dic.ADictionary
AL_TODO_FILE, config, mixPrefixLength, mixSuffixLength, sync
-
Fields inherited from interface org.lionsoul.jcseg.IDictionary
HASHMAP
-
-
Constructor Summary
Constructors Constructor Description HashMapDictionary(SegmenterConfig config, Boolean sync)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IWordadd(int t, String key, int type)add a new word to the dictionaryIWordadd(int t, String key, int fre, int type)add a new word to the dictionaryIWordadd(int t, String key, int fre, int type, String[] entity)add a new word to the dictionary with its statistics frequencyIWordadd(int t, String key, int type, String[] entity)add a new word to the dictionaryIWordadd(int t, IWord word)directly add a IWord item to the dictionaryIWordget(int t, String key)return the IWord associate with the given key.booleanmatch(int t, String key)loop up the dictionary, check the given key is in the dictionary or notvoidremove(int t, String key)remove the mapping associate with the given keyintsize(int t)return the size of the dictionary-
Methods inherited from class org.lionsoul.jcseg.dic.ADictionary
getConfig, getIndex, isSync, load, load, load, loadClassPath, loadDirectory, loadWords, loadWords, loadWords, resetPrefixLength, resetSuffixLength, resetSynonymsNet, startAutoload, stopAutoload
-
-
-
-
Constructor Detail
-
HashMapDictionary
public HashMapDictionary(SegmenterConfig config, Boolean sync)
-
-
Method Detail
-
match
public boolean match(int t, String key)Description copied from interface:IDictionaryloop up the dictionary, check the given key is in the dictionary or not- Specified by:
matchin interfaceIDictionary- See Also:
IDictionary.match(int, String)
-
add
public IWord add(int t, IWord word)
Description copied from interface:IDictionarydirectly add a IWord item to the dictionary- Specified by:
addin interfaceIDictionary- See Also:
IDictionary.add(int, IWord)
-
add
public IWord add(int t, String key, int fre, int type, String[] entity)
Description copied from interface:IDictionaryadd a new word to the dictionary with its statistics frequency- Specified by:
addin interfaceIDictionary- See Also:
IDictionary.add(int, String, int, int, String[])
-
add
public IWord add(int t, String key, int type)
Description copied from interface:IDictionaryadd a new word to the dictionary- Specified by:
addin interfaceIDictionary- See Also:
IDictionary.add(int, String, int)
-
add
public IWord add(int t, String key, int fre, int type)
Description copied from interface:IDictionaryadd a new word to the dictionary- Specified by:
addin interfaceIDictionary- See Also:
IDictionary.add(int, String, int, int)
-
add
public IWord add(int t, String key, int type, String[] entity)
Description copied from interface:IDictionaryadd a new word to the dictionary- Specified by:
addin interfaceIDictionary- See Also:
IDictionary.add(int, String, int, String[])
-
get
public IWord get(int t, String key)
Description copied from interface:IDictionaryreturn the IWord associate with the given key. if there is not mapping for the key null will be return- Specified by:
getin interfaceIDictionary- See Also:
IDictionary.get(int, String)
-
remove
public void remove(int t, String key)Description copied from interface:IDictionaryremove the mapping associate with the given key- Specified by:
removein interfaceIDictionary- See Also:
IDictionary.remove(int, String)
-
size
public int size(int t)
Description copied from interface:IDictionaryreturn the size of the dictionary- Specified by:
sizein interfaceIDictionary- See Also:
IDictionary.size(int)
-
-