Class BinaryDictionaryWriter<T extends BinaryDictionary<? extends MorphData>>

java.lang.Object
org.apache.lucene.analysis.morph.BinaryDictionaryWriter<T>
Direct Known Subclasses:
TokenInfoDictionaryWriter, TokenInfoDictionaryWriter, UnknownDictionaryWriter, UnknownDictionaryWriter

public abstract class BinaryDictionaryWriter<T extends BinaryDictionary<? extends MorphData>> extends Object
Abstract base dictionary writer class.
  • Field Details

    • implClazz

      private final Class<T extends BinaryDictionary<? extends MorphData>> implClazz
    • targetMapEndOffset

      private int targetMapEndOffset
    • lastWordId

      private int lastWordId
    • lastSourceId

      private int lastSourceId
    • targetMap

      private int[] targetMap
    • targetMapOffsets

      private int[] targetMapOffsets
    • entryWriter

      protected final DictionaryEntryWriter entryWriter
  • Constructor Details

  • Method Details

    • put

      public int put(String[] entry)
      put the entry in map
      Returns:
      current position of buffer, which will be wordId of next entry
    • write

      public abstract void write(Path baseDir) throws IOException
      Write whole dictionary in a directory.
      Throws:
      IOException - if an I/O error occurs writing the dictionary files
    • addMapping

      protected void addMapping(int sourceId, int wordId)
    • write

      protected void write(Path baseDir, String targetMapCodecHeader, String posDictCodecHeader, String dictCodecHeader, int dictCodecVersion) throws IOException
      Write dictionary in file Dictionary format is: [Size of dictionary(int)], [entry:{left id(short)}{right id(short)}{word cost(short)}{length of pos info(short)}{pos info(char)}], [entry...], [entry...].....
      Throws:
      IOException - if an I/O error occurs writing the dictionary files
    • getBaseFileName

      protected final String getBaseFileName()
    • writeTargetMap

      private void writeTargetMap(Path path, String targetMapCodecHeader, int dictCodecVersion) throws IOException
      Throws:
      IOException