public abstract class ADictionary extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
AL_TODO_FILE
the default autoload task file name
|
protected JcsegTaskConfig |
config |
protected boolean |
sync |
| Constructor and Description |
|---|
ADictionary(JcsegTaskConfig config,
Boolean sync)
initialize the ADictionary
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
add(int t,
String key,
int type)
add a new word to the dictionary
|
abstract void |
add(int t,
String key,
int fre,
int type)
add a new word to the dictionary with its statistics frequency
|
abstract IWord |
get(int t,
String key)
return the IWord asscociate with the given key.
|
JcsegTaskConfig |
getConfig() |
static int |
getIndex(String key)
get the key's type index located in ILexicon interface
|
boolean |
isSync() |
void |
load(File file)
load all the words from a specified lexicon file
|
void |
load(InputStream is)
load all the words from a specified lexicon input stream
|
void |
load(String file)
load all the words from a specified lexicon path
|
void |
loadClassPath()
load all the words from all the files under the specified class path.
|
void |
loadDirectory(String lexDir)
load the all the words form all the files under a specified lexicon directionry
|
static void |
loadWords(JcsegTaskConfig config,
ADictionary dic,
File file)
load all the words in the specified lexicon file into the dictionary
|
static void |
loadWords(JcsegTaskConfig config,
ADictionary dic,
InputStream is)
load words from a InputStream
|
static void |
loadWords(JcsegTaskConfig config,
ADictionary dic,
String file)
load all the words from a specified lexicon file path
|
abstract boolean |
match(int t,
String key)
loop up the dictionary, check the given key is in the dictionary or not
|
abstract void |
remove(int t,
String key)
remove the mapping associate with the given key
|
void |
setConfig(JcsegTaskConfig config) |
abstract int |
size(int t)
return the size of the dictionary
|
void |
startAutoload()
start the lexicon autoload thread
|
void |
stopAutoload() |
public static final String AL_TODO_FILE
protected JcsegTaskConfig config
protected boolean sync
public ADictionary(JcsegTaskConfig config, Boolean sync)
config - sync - public void load(File file) throws NumberFormatException, FileNotFoundException, IOException
file - IOExceptionFileNotFoundExceptionNumberFormatExceptionpublic void load(String file) throws NumberFormatException, FileNotFoundException, IOException
file - IOExceptionFileNotFoundExceptionNumberFormatExceptionpublic void load(InputStream is) throws NumberFormatException, IOException
is - IOExceptionNumberFormatExceptionpublic void loadDirectory(String lexDir) throws IOException
lexDir - IOExceptionpublic void loadClassPath()
throws IOException
lexDir - IOExceptionpublic void startAutoload()
public void stopAutoload()
public boolean isSync()
public abstract boolean match(int t,
String key)
t - key - public abstract void add(int t,
String key,
int type)
t - key - type - public abstract void add(int t,
String key,
int fre,
int type)
t - key - fre - type - public abstract IWord get(int t, String key)
t - key - public abstract void remove(int t,
String key)
t - key - public abstract int size(int t)
t - public static int getIndex(String key)
key - public JcsegTaskConfig getConfig()
public void setConfig(JcsegTaskConfig config)
public static void loadWords(JcsegTaskConfig config, ADictionary dic, File file) throws NumberFormatException, FileNotFoundException, IOException
config - dic - file - IOExceptionFileNotFoundExceptionNumberFormatExceptionpublic static void loadWords(JcsegTaskConfig config, ADictionary dic, String file) throws NumberFormatException, FileNotFoundException, IOException
config - dic - file - IOExceptionFileNotFoundExceptionNumberFormatExceptionpublic static void loadWords(JcsegTaskConfig config, ADictionary dic, InputStream is) throws NumberFormatException, IOException
config - dic - is - IOExceptionNumberFormatExceptionCopyright © 2016. All Rights Reserved.