Class CategoryTable.CategoryAssignment

java.lang.Object
opennlp.tools.tokenize.lattice.CategoryTable.CategoryAssignment
Enclosing class:
CategoryTable

static final class CategoryTable.CategoryAssignment extends Object
The categories assigned to one code point, stored both in mapping order and as a mask over the dictionary's dense category ids. The mask is an int, which holds every id because MecabDictionary accepts at most 17 categories.
  • Field Details

  • Constructor Details

    • CategoryAssignment

      CategoryAssignment(MecabDictionary.Category[] categories)
      Creates an assignment with the first entry as the primary category.
      Parameters:
      categories - The categories in mapping order. Must not be empty.
      Throws:
      IllegalArgumentException - Thrown if categories is null or empty.
  • Method Details

    • primary

      Returns the first category on the mapping.
      Returns:
      The category that supplies unknown-word settings.
    • continuedRunEnd

      int continuedRunEnd(CategoryTable.CategoryAssignment next, int nextRunEnd, int characterEnd)
      Computes the run end after comparing this assignment with the next character. MeCab's seekToOtherType replaces the current mask after each accepted character, so successive assignments must overlap.
      Parameters:
      next - The next character's assignment, or null at the end of text.
      nextRunEnd - The run end calculated at the next character.
      characterEnd - The exclusive end of the current character.
      Returns:
      nextRunEnd when the assignments intersect; characterEnd otherwise.