public void loadSimplePatterns(InputStream stream) { SimplePatternParser pp = new SimplePatternParser(); ivalues = new TernaryTree(); pp.parse(stream, this); // patterns/values should be now in the tree // let's optimize a bit trimToSize(); vspace.trimToSize(); classmap.trimToSize(); // get rid of the auxiliary map ivalues = null; }
public String findPattern(String pat) { int k = super.find(pat); if (k >= 0) { return unpackValues(k); } return ""; }
/** * @param lang * @param country */ public void setLanguage(String lang, String country) { hyphenTree = getHyphenationTree(lang, country); }
public HyphenationTree() { stoplist = new HashMap(23); // usually a small table classmap = new TernaryTree(); vspace = new ByteVector(); vspace.alloc(1); // this reserves index 0, which we don't use }
public void printStats() { System.out.println("Value space size = " + vspace.length()); super.printStats(); } }
/** * @param word * @return a hyphenation object */ public Hyphenation hyphenate(String word) { if (hyphenTree == null) { return null; } return hyphenTree.hyphenate(word, remainCharCount, pushCharCount); }
/** Creates a new hyphenation instance usable in <CODE>Chunk</CODE>. * @param lang the language ("en" for English, for example) * @param country the country ("GB" for Great-Britain or "none" for no country, for example) * @param leftMin the minimum number of letters before the hyphen * @param rightMin the minimum number of letters after the hyphen */ public HyphenationAuto(String lang, String country, int leftMin, int rightMin) { hyphenator = new Hyphenator(lang, country, leftMin, rightMin); }
protected void init() { root = 0; freenode = 1; length = 0; lo = new char[BLOCK_SIZE]; hi = new char[BLOCK_SIZE]; eq = new char[BLOCK_SIZE]; sc = new char[BLOCK_SIZE]; kv = new CharVector(); }
public void loadSimplePatterns(InputStream stream) { SimplePatternParser pp = new SimplePatternParser(); ivalues = new TernaryTree(); pp.parse(stream, this); // patterns/values should be now in the tree // let's optimize a bit trimToSize(); vspace.trimToSize(); classmap.trimToSize(); // get rid of the auxiliary map ivalues = null; }
public HyphenationTree() { stoplist = new HashMap(23); // usually a small table classmap = new TernaryTree(); vspace = new ByteVector(); vspace.alloc(1); // this reserves index 0, which we don't use }
public String findPattern(String pat) { int k = super.find(pat); if (k >= 0) { return unpackValues(k); } return ""; }
/** * @param lang * @param country * @param leftMin * @param rightMin */ public Hyphenator(String lang, String country, int leftMin, int rightMin) { hyphenTree = getHyphenationTree(lang, country); remainCharCount = leftMin; pushCharCount = rightMin; }
/** * @param word * @return a hyphenation object */ public Hyphenation hyphenate(String word) { if (hyphenTree == null) { return null; } return hyphenTree.hyphenate(word, remainCharCount, pushCharCount); }
public void loadSimplePatterns(InputStream stream) { SimplePatternParser pp = new SimplePatternParser(); ivalues = new TernaryTree(); pp.parse(stream, this); // patterns/values should be now in the tree // let's optimize a bit trimToSize(); vspace.trimToSize(); classmap.trimToSize(); // get rid of the auxiliary map ivalues = null; }
public String findPattern(String pat) { int k = super.find(pat); if (k >= 0) { return unpackValues(k); } return ""; }
/** * @param lang * @param country * @param leftMin * @param rightMin */ public Hyphenator(String lang, String country, int leftMin, int rightMin) { hyphenTree = getHyphenationTree(lang, country); remainCharCount = leftMin; pushCharCount = rightMin; }
/** * @param word * @return a hyphenation object */ public Hyphenation hyphenate(String word) { if (hyphenTree == null) { return null; } return hyphenTree.hyphenate(word, remainCharCount, pushCharCount); }
/** * @param lang * @param country */ public void setLanguage(String lang, String country) { hyphenTree = getHyphenationTree(lang, country); }
/** * @param lang * @param country * @param leftMin * @param rightMin */ public Hyphenator(String lang, String country, int leftMin, int rightMin) { hyphenTree = getHyphenationTree(lang, country); remainCharCount = leftMin; pushCharCount = rightMin; }
/** * @param lang * @param country */ public void setLanguage(String lang, String country) { hyphenTree = getHyphenationTree(lang, country); }