takuyaa / kuromoji.js

JavaScript implementation of Japanese morphological analyzer
832 stars 117 forks source link

Can not load dict from external URL #37

Open georgeOsdDev opened 4 years ago

georgeOsdDev commented 4 years ago

We are trying to use kuromoji.js with kuromojin on browser. When we use external url as dicPath option, double slash is normalized by path.join.

> require("path").join("http://external-url.com/dict", "base.dat.gz");
'http:/external-url.com/dict/base.dat.gz'

So XMLHttpRequest will go to https://mydomain.com/external-url.com/dict/base.dat.gz And fail to load dict.

Screen Shot 2020-01-29 at 4 51 25 AM Screen Shot 2020-01-29 at 4 52 27 AM

chinenvinicius commented 1 year ago

@georgeOsdDev im having the same issue. im using kuroshiro to change kanji to furigana however when i try to use external cdn for the dict path. it seems to work fine on localhost but not on live server. did u find any workaround for this issue? if so would help me?

georgeOsdDev commented 1 year ago

@chinenvinicius You could find some solutions linked on this thread. My workaround is https://github.com/mobilusoss/textlint-browser-runner/pull/7