|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkr.ac.kaist.swrc.jhannanum.plugin.MajorPlugin.MorphAnalyzer.ChartMorphAnalyzer.Trie
public class Trie
TRIE data structure for morpheme dictionaries.
Nested Class Summary | |
---|---|
class |
Trie.FREE
This class is for managing free nodes in the trie structure. |
class |
Trie.INFO
This class is for the information of morpheme |
class |
Trie.TNODE
This class is for nodes of trie structure. |
Field Summary | |
---|---|
static int |
DEFAULT_TRIE_BUF_SIZE_SYS
the default buffer size for the system dictionary |
static int |
DEFAULT_TRIE_BUF_SIZE_USER
the default buffer size for the user dictionary |
Trie.FREE |
free_head
the head of free node list |
static int |
FREE_NODE
the index of the free node |
Trie.TNODE |
node_head
the head of node list |
int |
search_end
the length of search result |
int[] |
search_idx
the list for storing the path searched |
char[] |
search_key
the list of keys of the path searched |
static int |
START_NODE
the index of the start node |
Trie.TNODE[] |
trie_buf
the array for trie nodes |
Constructor Summary | |
---|---|
Trie(int buf_size)
Constructor. |
Method Summary | |
---|---|
Trie.TNODE |
fetch(char[] word)
Fetches the specified word. |
Trie.TNODE |
get_node(int idx)
Gets the trie node on the specified index |
int |
node_alloc(int size)
Allocates the trie nodes available as the specified size |
void |
node_free(int fidx,
int size)
It frees the nodes from the specified index. |
int |
node_look(char key,
int idx)
It checks the children of the node on the specified index whether a child has the key. |
void |
print_result(TagSet tagSet)
It writes the data in trie structure to the specified file. |
void |
print_trie(java.io.PrintWriter pw,
int idx,
int depth,
TagSet tagSet)
It prints the trie structure by recursive call. |
void |
read_dic(java.lang.String dictionaryFileName,
TagSet tagSet)
It reads the morpheme dictionary file, and initializes the trie structure. |
int |
search(char[] word)
It searches the specified word on the trie structure. |
int |
store(char[] word,
Trie.INFO inode)
It stores the specified word in the trie structure. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_TRIE_BUF_SIZE_SYS
public static final int DEFAULT_TRIE_BUF_SIZE_USER
public static final int FREE_NODE
public static final int START_NODE
public int search_end
public int[] search_idx
public char[] search_key
public Trie.TNODE[] trie_buf
public Trie.FREE free_head
public Trie.TNODE node_head
Constructor Detail |
---|
public Trie(int buf_size)
buf_size
- - the maximum number of trie nodesMethod Detail |
---|
public Trie.TNODE fetch(char[] word)
word
- - the word to fetch
public Trie.TNODE get_node(int idx)
idx
- - index on the trie structure
public int node_alloc(int size)
size
- - the number of nodes to allocate
public void node_free(int fidx, int size)
fidx
- - the start index of node group to freesize
- - the number of nodes to freepublic int node_look(char key, int idx)
key
- - key to searchidx
- - the index of the parent node
public void print_result(TagSet tagSet)
tagSet
- - the morpheme tag set used in the trie structurepublic void print_trie(java.io.PrintWriter pw, int idx, int depth, TagSet tagSet)
pw
- - for printing the trie structureidx
- - the index of trie nodedepth
- - the depth of current nodetagSet
- - the morpheme tag set used in the trie structurepublic void read_dic(java.lang.String dictionaryFileName, TagSet tagSet) throws java.io.IOException
dictionaryFileName
- - the file path of the morpheme dictionarytagSet
- - the morpheme tag set
java.io.IOException
public int search(char[] word)
word
- - word to search
public int store(char[] word, Trie.INFO inode)
word
- - the word to storeinode
- - the information of the word
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |