Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Use single break iterator instance, spellcheck hyphenated compounds separately

AuthorDaveJarvis <email>
Date2020-07-08 20:29:44 GMT-0700
Commit2ab77df63e9bcb63b5ff741ad2d98cbb948fed1e
Parent1259f26
Delta5 lines added, 4 lines removed, 1-line increase
src/main/java/com/scrivenvar/spelling/impl/SymSpellSpeller.java
*/
public class SymSpellSpeller implements SpellChecker {
+ private final BreakIterator mBreakIterator = BreakIterator.getWordInstance();
+
private final SymSpell mSymSpell;
assert consumer != null;
- final BreakIterator wb = BreakIterator.getWordInstance();
- wb.setText( text );
+ mBreakIterator.setText( text );
- int boundaryIndex = wb.first();
+ int boundaryIndex = mBreakIterator.first();
int previousIndex = 0;
previousIndex = boundaryIndex;
- boundaryIndex = wb.next();
+ boundaryIndex = mBreakIterator.next();
}
}