/** * 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 */ public void write(String baseDir) throws IOException { final String baseName = getBaseFileName(baseDir); writeDictionary(baseName + BinaryDictionary.DICT_FILENAME_SUFFIX); writeTargetMap(baseName + BinaryDictionary.TARGETMAP_FILENAME_SUFFIX); writePosDict(baseName + BinaryDictionary.POSDICT_FILENAME_SUFFIX); }
public BinaryDictionaryWriter(Class<? extends BinaryDictionary> implClazz, int size) { this.implClazz = implClazz; buffer = ByteBuffer.allocate(size); }