public final class PersistentTrie
extends java.lang.Object
History:
Modifier and Type | Field and Description |
---|---|
static long |
LEGAL_BASE |
static long |
LEGAL_CATEGORY
a number get by using bit-or for legal categories:
adj, adv, noun, verb
|
static long |
LEGAL_INFLECTION
a number get by using bit-or for legal inflections:
base - singular - plural
- positive - comparative - superlative
- infinitive - pres - past - presPart - pastPart
|
Constructor and Description |
---|
PersistentTrie(boolean isInflection,
int minTermLength,
java.lang.String dir)
Create an object of LVG persistent trie, using a flag to indicate
using inflection or derivation trie.
|
PersistentTrie(java.io.RandomAccessFile trieRaf,
java.io.RandomAccessFile ruleRaf,
java.io.RandomAccessFile exceptionRaf,
int minTermLength,
boolean isInflection)
Create an object of LVG persistent trie, using random acccess files
of trie, rule, and exception.
|
Modifier and Type | Method and Description |
---|---|
(package private) static java.util.Vector<RuleResult> |
AddRusultsToInflectList(java.util.Vector<RuleResult> oldList,
java.util.Vector<RuleResult> newList) |
void |
Close()
Close all random access files of Lvg persistent trie, rules, exceptions.
|
CatInfl |
GetCatInflByRules(java.lang.String term,
long inCat,
long inInfl)
Get all possible categories and inflections for a term from trie rules.
|
java.util.Vector<CatInfl> |
GetCatInflsByRules(java.lang.String term,
long inCat,
long inInfl)
Get all possible categories and inflections for a term from trie rules.
|
java.util.Vector<RuleResult> |
GetDerivationsByRules(java.lang.String term,
long inCat,
long inInfl,
boolean showAll)
Get derivation for a specific term from LVG trie rules.
|
java.util.Vector<RuleResult> |
GetInflectedTermsByRules(java.lang.String term,
long inCat,
long inInfl,
boolean showAll)
Get inflected terms for a specific term from LVG trie rules.
|
int |
GetMatchedNodeNum()
Get the total number of nodes which match suffix
|
java.util.Vector<RuleResult> |
GetUninflectedTermsByRules(java.lang.String term,
long inCat,
long inInfl,
boolean showAll)
Get uninflected terms for a specific inflected term from LVG trie rules.
|
static void |
main(java.lang.String[] args)
A test driver for this class.
|
void |
PrintResults(java.util.Vector<RuleResult> resultList)
Print out a collection of trie ruleresult.
|
void |
SetMinTermLength(int minTermLength)
Set the minimum term length
|
public static final long LEGAL_CATEGORY
public static final long LEGAL_INFLECTION
public static final long LEGAL_BASE
public PersistentTrie(boolean isInflection, int minTermLength, java.lang.String dir)
isInflection
- true or false to indicate the persistent trie
type as inflections or derivations.minTermLength
- minimum length of rule generated out termdir
- the top directory of LVGpublic PersistentTrie(java.io.RandomAccessFile trieRaf, java.io.RandomAccessFile ruleRaf, java.io.RandomAccessFile exceptionRaf, int minTermLength, boolean isInflection)
trieRaf
- random access file of Lvg persistent trieruleRaf
- random access file of Lvg persistent ruleexceptionRaf
- random access file of Lvg persistent exceptionminTermLength
- minimum length of rule generated out termisInflection
- true or false to indicate the persistent trie
type as inflections or derivations.public void Close()
public java.util.Vector<RuleResult> GetUninflectedTermsByRules(java.lang.String term, long inCat, long inInfl, boolean showAll)
term
- the term to be found for uninflectionsinCat
- the input categoryinInfl
- the input inflectionshowAll
- set false to get uninflected terms from a node that has
matching suffix and ignore all other matching nodes above it in the
same tree branch.
public CatInfl GetCatInflByRules(java.lang.String term, long inCat, long inInfl)
term
- the term to be found all possible categories and inflectionsinCat
- input categoriesinInfl
- input inflectionspublic java.util.Vector<CatInfl> GetCatInflsByRules(java.lang.String term, long inCat, long inInfl)
term
- the term to be found all possible categories and inflectionsinCat
- input categoriesinInfl
- input inflectionspublic java.util.Vector<RuleResult> GetInflectedTermsByRules(java.lang.String term, long inCat, long inInfl, boolean showAll)
term
- the term to be found for inflectionsinCat
- the input categoryinInfl
- the input inflectionshowAll
- set false to get inflected terms from a node that has
matching suffix and ignore all other matching nodes above it in the
same tree branch.
public java.util.Vector<RuleResult> GetDerivationsByRules(java.lang.String term, long inCat, long inInfl, boolean showAll)
term
- the term to be found for derivationsinCat
- the input categoryinInfl
- the input inflectionshowAll
- set false to get derivation from a node that has
matching suffix and ignore all other matching nodes above it in the
same tree branch.
public void PrintResults(java.util.Vector<RuleResult> resultList)
resultList
- A vector of ruleResult to be print out.public int GetMatchedNodeNum()
public void SetMinTermLength(int minTermLength)
minTermLength
- minimum term length used in Morpologypublic static void main(java.lang.String[] args)
args
- argumentsstatic java.util.Vector<RuleResult> AddRusultsToInflectList(java.util.Vector<RuleResult> oldList, java.util.Vector<RuleResult> newList)