Class BinaryDictionaryWriter
- java.lang.Object
-
- org.apache.lucene.analysis.ko.util.BinaryDictionaryWriter
-
- Direct Known Subclasses:
TokenInfoDictionaryWriter
,UnknownDictionaryWriter
abstract class BinaryDictionaryWriter extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected java.nio.ByteBuffer
buffer
private static int
ID_LIMIT
private java.lang.Class<? extends BinaryDictionary>
implClazz
private int
lastSourceId
private int
lastWordId
private java.util.ArrayList<java.lang.String>
posDict
private int[]
targetMap
private int
targetMapEndOffset
private int[]
targetMapOffsets
-
Constructor Summary
Constructors Constructor Description BinaryDictionaryWriter(java.lang.Class<? extends BinaryDictionary> implClazz, int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addMapping(int sourceId, int wordId)
(package private) java.lang.String
getBaseFileName()
int
put(java.lang.String[] entry)
put the entry in mapvoid
write(java.nio.file.Path baseDir)
Write dictionary in fileprivate void
writeDictionary(java.nio.file.Path path)
private void
writePosDict(java.nio.file.Path path)
private void
writeString(java.lang.String s)
private void
writeTargetMap(java.nio.file.Path path)
-
-
-
Field Detail
-
ID_LIMIT
private static final int ID_LIMIT
- See Also:
- Constant Field Values
-
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 mapmecab-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
-
-