Class HunspellDictionary.BoundaryIndex

java.lang.Object
opennlp.tools.stemmer.hunspell.HunspellDictionary.BoundaryIndex
Enclosing class:
HunspellDictionary

private static final class HunspellDictionary.BoundaryIndex extends Object
An immutable index of affix rules keyed by the boundary code point of their affix material, answering each lookup by binary search so the per-word scans in HunspellStemmer allocate nothing.
  • Field Details

    • boundaries

      private final int[] boundaries
      The boundary code points, sorted ascending.
    • buckets

      private final List<List<HunspellDictionary.Affix>> buckets
      The rule bucket for each boundary, aligned with boundaries.
  • Constructor Details

    • BoundaryIndex

      private BoundaryIndex(Map<Integer,List<HunspellDictionary.Affix>> byBoundary)
      Initializes the index from mutable buckets, freezing each one.
      Parameters:
      byBoundary - The rule buckets keyed by boundary code point.
  • Method Details

    • bucket

      List<HunspellDictionary.Affix> bucket(int codePoint)
      The rules bucketed under a boundary code point.
      Parameters:
      codePoint - The boundary code point to look up.
      Returns:
      The bucket, possibly empty. Never null.