Class BinaryDictionaryWriter

    • Field Detail

      • implClazz

        private final java.lang.Class<? extends BinaryDictionary> implClazz
      • buffer

        protected java.nio.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 java.util.ArrayList<java.lang.String> posDict
    • Constructor Detail

      • BinaryDictionaryWriter

        BinaryDictionaryWriter​(java.lang.Class<? extends BinaryDictionary> implClazz,
                               int size)
    • Method Detail

      • put

        public int put​(java.lang.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​(java.lang.String s)
      • addMapping

        void addMapping​(int sourceId,
                        int wordId)
      • getBaseFileName

        final java.lang.String getBaseFileName()
      • write

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

        private void writeTargetMap​(java.nio.file.Path path)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writePosDict

        private void writePosDict​(java.nio.file.Path path)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • writeDictionary

        private void writeDictionary​(java.nio.file.Path path)
                              throws java.io.IOException
        Throws:
        java.io.IOException