WorksApplications/Sudachi

Dictionary file Loading support from jar

santosa-malika opened this issue · 5 comments

if the Dictionary file is kept inside some resource jar , then the MMap.class cannot read the Dictionary file,

so can this be modified to support BinaryDictionary.class.getClassLoader().getResourceAsStream("system_core.dic ")
Then from InputStream we can get ByteBuffer using below logic
ByteBuffer byteBuffer = ByteBuffer.allocate(initialStream.available());
ReadableByteChannel channel = newChannel(initialStream);
IOUtils.readFully(channel, byteBuffer);

I've received requests to read the dictionary from the jar, and I know how to do it, but I haven't come up with a spec for the config file and a clean implementation, so please wait a little longer.

For Example :

  1. The Dictionary file “system_core.dic” & “sudachi.json” Is placed inside some jar , example $PROJECT_HOME/lib/resource.jar”
  2. The Sudachi Jar is inside $PROJECT_HOME/lib/sudachi-0.4.3.jar
  3. As the “system_core.dic” inside the jar , so the sudachi-0.4.3.jar cannot read the Dictionary file . when the system_core.dic inside $PROJECT_HOME/lib/ system_core.dic then its OK.
  4. So to support to when Dictionary file inside some jar like $PROJECT_HOME/lib/resource.jar/japanese_dictionary/system_core.dic I have raised above request .

Dear, any update on the above request to support in the newer version .

Dear, any update or plan on the above request to support in the newer version .

Actually, it should work with the version in develop branch, however the functionality is not tested and will not be officially supported.