public class Hunspell extends Object implements Closeable
| Constructor and Description |
|---|
Hunspell(String dictionaryPath,
String affixPath)
Instantiate a hunspell object with the given dictionary and affix file
|
Hunspell(String dictionaryPath,
String affixPath,
String key)
Instantiate a hunspell object with the given hunzipped dictionary and
affix files.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(String word)
Add a word to the runtime dictionary.
|
void |
addDic(String dpath)
Add an additional dictionary file (.dic file only, no affix file)
to the runtime dictionary.
|
void |
addWithAffix(String word,
String exampleWord)
Add the word to the runtime dictionary with the affix flags of the given
example word so that affixed versions will be recognized as well.
|
List<String> |
analyze(String word)
Morphological analysis of the given word.
|
void |
close()
This method will handle the destruction of the Hunspell instance and
ensure that the memory is reclaimed.
|
protected void |
finalize() |
List<String> |
generate(String word,
List<String> basedOnAnalysis)
Generate a form for the given word based on the analysis of a second word.
|
List<String> |
generate(String word,
String basedOn)
Generate a form for the first word based on the second word.
|
String |
getDictionaryEncoding()
Get the dictionary encoding for this object.
|
boolean |
isCorrect(String word)
Same as
spell(String) |
void |
remove(String word)
Remove a word from the runtime dictionary.
|
boolean |
spell(String word)
Spellcheck the given word.
|
List<String> |
stem(List<String> analysis)
Gets the stems of a word from the results of
analyze(String). |
List<String> |
stem(String word)
Gets the stems of the word.
|
List<String> |
suggest(String word)
Suggest a list of corrections for the given word.
|
org.bridj.Pointer<org.bridj.Pointer<Byte>> |
toEncodedCStringList(List<String> strings)
Convert a list of strings to a list of cstrings in the
dictionary encoding.
|
public Hunspell(String dictionaryPath, String affixPath)
dictionaryPath - the path to the dictionaryaffixPath - the path to the affix filepublic Hunspell(String dictionaryPath, String affixPath, String key)
Instantiate a hunspell object with the given hunzipped dictionary and affix files.
This is, however more complicated than it looks. Note that the paths
aren't actually to the hunzipped dictionary and affix files, they are the
paths to what they would be named if they weren't hunzipped. In other
words, if you have the files /path/to/dictionary.dic.hz and
/path/to/dictionary.aff.hz you would call
new Hunspell("/path/to/dictionary.dic", "/path/to/dictionary.aff", "password")
. Note, however, that if the paths that you give actually exist, those
will be prioritized over the hunzipped versions and will be used instead.
dictionaryPath - the path to the dictionaryaffixPath - the path to the affix filekey - the key used to encrypt the dictionary filespublic boolean spell(String word)
word - the word to checkHunspellLibrary.Hunspell_spell(Pointer, Pointer)public boolean isCorrect(String word)
spell(String)word - the word to check.spell(String)public String getDictionaryEncoding()
HunspellLibrary.Hunspell_get_dic_encoding(Pointer)public List<String> suggest(String word)
word - the word to get suggestions forHunspellLibrary.Hunspell_suggest(Pointer, Pointer, Pointer)public List<String> analyze(String word)
word - the word to analyzeHunspellLibrary.Hunspell_analyze(Pointer, Pointer, Pointer)public List<String> stem(String word)
word - the wordHunspellLibrary.Hunspell_stem(Pointer, Pointer, Pointer)public List<String> stem(List<String> analysis)
analyze(String).analysis - the results of analyze(String)HunspellLibrary.Hunspell_stem2(Pointer, Pointer, Pointer, int)public List<String> generate(String word, String basedOn)
word - the word to generate the form forbasedOn - the word to base the generation onHunspellLibrary.Hunspell_generate(Pointer, Pointer, Pointer, Pointer)public List<String> generate(String word, List<String> basedOnAnalysis)
word - the word for which to generate the formbasedOnAnalysis - the analysis of the word that it is based onHunspellLibrary.Hunspell_generate2(Pointer, Pointer, Pointer, Pointer, int)public void addDic(String dpath)
dpath - the Path to the dictionary file.HunspellLibrary.Hunspell_add_dic(Pointer, Pointer)public void add(String word)
word - the word to addHunspellLibrary.Hunspell_add(Pointer, Pointer)public void addWithAffix(String word, String exampleWord)
word - the wordexampleWord - a word that shows an example of what affix rules applyHunspellLibrary.Hunspell_add_with_affix(Pointer, Pointer, Pointer)public void remove(String word)
word - the word to removeHunspellLibrary.Hunspell_remove(Pointer, Pointer)public void close()
close in interface Closeableclose in interface AutoCloseableprotected void finalize()
throws Throwable
Copyright © 2012-2016 Atlas Copco Drilling Solutions. All Rights Reserved.