kuromojin icon indicating copy to clipboard operation
kuromojin copied to clipboard

CDN not found because of path.join in Kuromoji.js

Open qqpann opened this issue 2 years ago • 2 comments

https://nodejs.org/api/path.html#path_path_join_paths https://github.com/takuyaa/kuromoji.js/blob/71ea8473bd119546977f22c61e4d52da28ac30a6/src/loader/DictionaryLoader.js#L51 After path.join, "https://" becomes "https:/" and causes 404 error in a browser.

In my use case, I use kuromojin in a web application and this results in "https://cdn.example.com/dict" to be "https://myapp.com/cdn.example.com/dict"and getTokenizer cannot find the dict files.

qqpann avatar Jul 12 '21 19:07 qqpann

https://github.com/textlint/editor/blob/630fd1ee938a2b39e8ae74afdbde157497125557/packages/%40textlint/script-compiler/patch/kuromoji.js#L50 https://github.com/textlint/editor/blob/630fd1ee938a2b39e8ae74afdbde157497125557/packages/%40textlint/script-compiler/src/compiler.ts#L86 I found there is α repository that makes original patch to deal with τhis problem. This might be α good reference.

qqpann avatar Jul 12 '21 19:07 qqpann

https://github.com/takuyaa/kuromoji.js/issues/37 This is kuromoji.js issue

azu avatar Jul 12 '21 23:07 azu