Class BinaryDictionaryWriter
java.lang.Object
org.apache.lucene.analysis.ja.util.BinaryDictionaryWriter
- Direct Known Subclasses:
TokenInfoDictionaryWriter
,UnknownDictionaryWriter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ByteBuffer
private static final int
private final Class<? extends BinaryDictionary>
private int
private int
private int[]
private int
private int[]
-
Constructor Summary
ConstructorsConstructorDescriptionBinaryDictionaryWriter
(Class<? extends BinaryDictionary> implClazz, int size) -
Method Summary
Modifier and TypeMethodDescription(package private) void
addMapping
(int sourceId, int wordId) (package private) final String
private boolean
isKatakana
(String s) int
put the entry in mapprivate static int
sharedPrefix
(String left, String right) private String
toKatakana
(String s) void
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
writeDictionary
(Path path) private void
private void
writePosDict
(Path path) private void
writeTargetMap
(Path path)
-
Field Details
-
ID_LIMIT
private static final int ID_LIMIT- See Also:
-
implClazz
-
buffer
-
targetMapEndOffset
private int targetMapEndOffset -
lastWordId
private int lastWordId -
lastSourceId
private int lastSourceId -
targetMap
private int[] targetMap -
targetMapOffsets
private int[] targetMapOffsets -
posDict
-
-
Constructor Details
-
BinaryDictionaryWriter
BinaryDictionaryWriter(Class<? extends BinaryDictionary> implClazz, int size)
-
-
Method Details
-
put
put the entry in map- Returns:
- current position of buffer, which will be wordId of next entry
-
isKatakana
-
writeKatakana
-
toKatakana
-
addMapping
void addMapping(int sourceId, int wordId) -
getBaseFileName
-
write
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
-
writeTargetMap
- Throws:
IOException
-
writePosDict
- Throws:
IOException
-
writeDictionary
- Throws:
IOException
-