Class BinaryDictionaryWriter

java.lang.Object
org.apache.lucene.analysis.ko.util.BinaryDictionaryWriter
Direct Known Subclasses:
TokenInfoDictionaryWriter, UnknownDictionaryWriter

abstract class BinaryDictionaryWriter extends Object
  • Field Details

    • ID_LIMIT

      private static final int ID_LIMIT
      See Also:
    • implClazz

      private final Class<? extends BinaryDictionary> implClazz
    • buffer

      protected ByteBuffer buffer
    • targetMapEndOffset

      private int targetMapEndOffset
    • lastWordId

      private int lastWordId
    • lastSourceId

      private int lastSourceId
    • targetMap

      private int[] targetMap
    • targetMapOffsets

      private int[] targetMapOffsets
    • posDict

      private final ArrayList<String> posDict
  • Constructor Details

  • Method Details

    • put

      public int put(String[] entry)
      put the entry in map

      mecab-ko-dic features

       0   - surface
       1   - left cost
       2   - right cost
       3   - word cost
       4   - part of speech0+part of speech1+...
       5   - semantic class
       6   - T if the last character of the surface form has a coda, F otherwise
       7   - reading
       8   - POS type (*, Compound, Inflect, Preanalysis)
       9   - left POS
       10  - right POS
       11  - expression
       
      Returns:
      current position of buffer, which will be wordId of next entry
    • writeString

      private void writeString(String s)
    • addMapping

      void addMapping(int sourceId, int wordId)
    • getBaseFileName

      final String getBaseFileName()
    • write

      public void write(Path baseDir) throws IOException
      Write dictionary in file
      Throws:
      IOException - if an I/O error occurs writing the dictionary files
    • writeTargetMap

      private void writeTargetMap(Path path) throws IOException
      Throws:
      IOException
    • writePosDict

      private void writePosDict(Path path) throws IOException
      Throws:
      IOException
    • writeDictionary

      private void writeDictionary(Path path) throws IOException
      Throws:
      IOException