Package org.apache.lucene.analysis.morph
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final DictionaryEntryWriter
private int
private int
private int[]
private int
private int[]
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BinaryDictionaryWriter
(Class<T> implClazz, DictionaryEntryWriter entryWriter) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addMapping
(int sourceId, int wordId) protected final String
int
put the entry in mapabstract void
Write whole dictionary in a directory.protected void
write
(Path baseDir, String targetMapCodecHeader, String posDictCodecHeader, String dictCodecHeader, int dictCodecVersion) 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...].....private void
writeTargetMap
(Path path, String targetMapCodecHeader, int dictCodecVersion)
-
Field Details
-
implClazz
-
targetMapEndOffset
private int targetMapEndOffset -
lastWordId
private int lastWordId -
lastSourceId
private int lastSourceId -
targetMap
private int[] targetMap -
targetMapOffsets
private int[] targetMapOffsets -
entryWriter
-
-
Constructor Details
-
BinaryDictionaryWriter
-
-
Method Details
-
put
put the entry in map- Returns:
- current position of buffer, which will be wordId of next entry
-
write
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
-
writeTargetMap
private void writeTargetMap(Path path, String targetMapCodecHeader, int dictCodecVersion) throws IOException - Throws:
IOException
-