Class BinaryDictionaryWriter
java.lang.Object
org.apache.lucene.analysis.ja.util.BinaryDictionaryWriter
- Direct Known Subclasses:
TokenInfoDictionaryWriter,UnknownDictionaryWriter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ByteBufferprivate static final intprivate final Class<? extends BinaryDictionary> private intprivate intprivate int[]private intprivate int[] -
Constructor Summary
ConstructorsConstructorDescriptionBinaryDictionaryWriter(Class<? extends BinaryDictionary> implClazz, int size) -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddMapping(int sourceId, int wordId) (package private) final Stringprivate booleanisKatakana(String s) intput the entry in mapprivate static intsharedPrefix(String left, String right) private StringtoKatakana(String s) voidWrite 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 voidwriteDictionary(Path path) private voidprivate voidwritePosDict(Path path) private voidwriteTargetMap(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
-