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

    Fields
    Modifier and Type
    Field
    Description
    static final FragmentChecker
     
  • Method Summary

    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 Details

  • Method Details

    • 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), then true can be returned for all ranges in 0..3, but not for 3..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 substrings
      start - the start of the range in question, inclusive
      end - the end of the range in question, inclusive, not smaller than start