Interface FragmentChecker
- All Known Implementing Classes:
NGramFragmentChecker
public interface FragmentChecker
An oracle for quickly checking that a specific part of a word can never be a valid word. This
allows speeding up the "Modification" part of
Suggester
by avoiding expensive checks on
impossible words. Implementations may use character case, n-grams or whatever they like.- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
hasImpossibleFragmentAround
(CharSequence word, int start, int end) Check if the given word range intersects any fragment which is impossible in the current language.
-
Field Details
-
EVERYTHING_POSSIBLE
-
-
Method Details
-
hasImpossibleFragmentAround
Check if the given word range intersects any fragment which is impossible in the current language. For example, if the word is "aaax", and there are no "aaa" combinations in words accepted by the spellchecker (but "aax" is valid), thentrue
can be returned for all ranges in0..3
, but not for3..4
.The implementation must be monotonic: if some range is considered impossible, larger ranges encompassing it should also produce
true
.- Parameters:
word
- the whole word being checked for impossible substringsstart
- the start of the range in question, inclusiveend
- the end of the range in question, inclusive, not smaller thanstart
-