constructor
Şöyle yaparız.
Şöyle yaparız.
Şöyle yaparız.
SpellChecker spell = null;
try {
Directory directory = FSDirectory.open(spellCheckerPath);
spell = new SpellChecker(directory);
spell .setAccuracy(0.5f);
} catch (IOException e) {
e.printStackTrace();
}
indexDictionary metodu
Şöyle yaparız.
Dictionary dictionary = null;
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(
new FileInputStream(new File(fileName)), "UTF-8"));
dictionary = new PlainTextDictionary(bufferedReader);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
IndexWriterConfig indexWriterConfig = new IndexWriterConfig(Version.LUCENE_4_10_2,
new StandardAnalyzer());
indexWriterConfig.setOpenMode(OpenMode.CREATE_OR_APPEND);
try {
spell.indexDictionary(dictionary, indexWriterConfig, true);
spell.close();
} catch (IOException e) {
e.printStackTrace();
}
Hiç yorum yok:
Yorum Gönder