Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ローカルでは動くのに、Webサーバー上ではkuromoji.jsが動作しません #43

Open
oaroid opened this issue Nov 3, 2020 · 8 comments

Comments

@oaroid
Copy link

oaroid commented Nov 3, 2020

ローカルでは以下のコードの状態でkuromoji.jsを使えるのですが、Webサーバー(Lolipop)にアップした途端に以下のようなエラーが出て使えません。
このエラーは一体どのようにしたら解決できるのでしょうか?サーバーの問題なんでしょうか?
お聞きしたいです。よろしくお願いいたします。

<script src="assets/kuromoji.js"></script>
<script>
kuromoji.builder({ dicPath: "assets/dict" }).build(function (err, tokenizer) {
    // tokenizer is ready
    var path = tokenizer.tokenize("すもももももももものうち");
    console.log(path);
});
</script>

image

@DhansAL
Copy link

DhansAL commented May 5, 2021

have anyone founded a solution to this?

@larvata
Copy link

larvata commented May 6, 2021

It seems caused by the server decompress the .gz file automatically.
You should check the webserver config.

Or modify the kuromoji code to prevent decompressing the dict:
hexenq/kuroshiro#27 (comment)

@chinenvinicius
Copy link

how u would modify it? i dont have any clue @larvata

@larvata
Copy link

larvata commented Aug 6, 2022

@chinenvinicius please check out the link above.
You need to comment 2 lines: 50-51
https://github.com/takuyaa/kuromoji.js/blob/master/src/loader/BrowserDictionaryLoader.js

@chinenvinicius
Copy link

in my case im being able to load the file because i put the exact path. however its .dat.gz files are taking 30 secods to load all file. im not sure what im doing wrong. @larvata

@larvata
Copy link

larvata commented Aug 10, 2022

@chinenvinicius
Have you tried the kuromoji demo site?
For me, it takes 15s for loading.
image

@chinenvinicius
Copy link

chinenvinicius commented Aug 13, 2022

so im using kuroshiro.js to put furigana on kanji.
and kuroshiro.js is dependent on kuromji dictionary.
On local server. its takes less than one second to load it. however when i put on live sever it takes about 30 seconds or even more. does the speed has anything to the sever or the code ? @larvata

@miusuncle
Copy link

miusuncle commented Apr 13, 2024

You can cache the dict data once fetched. Take a look at an approach at https://miusuncle.github.io/japen/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants