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 ofSuggester
by avoiding expensive checks on impossible words. Implementations may use character case, n-grams or whatever they like.- See Also:
NGramFragmentChecker
-
-
Field Summary
Fields Modifier and Type Field Description static FragmentChecker
EVERYTHING_POSSIBLE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
hasImpossibleFragmentAround(CharSequence word, int start, int end)
Check if the given word range intersects any fragment which is impossible in the current language.
-
-
-
Field Detail
-
EVERYTHING_POSSIBLE
static final FragmentChecker EVERYTHING_POSSIBLE
-
-
Method Detail
-
hasImpossibleFragmentAround
boolean hasImpossibleFragmentAround(CharSequence word, int start, int end)
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
-
-