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
Error when calling kuroshiro init [invalid file signature] even though files are found #27
Comments
Thanks for the feedback. Are you using webpack or other module bundler? The error message seems throwed out by zlib. Usually it cause by corrupted file. Though files works in Node.js, I suggest you re-download those files and try again see if it works. |
After looking at it again, I too think it has something to do with zlib. I tried redownloading the files, but it didn't help. I guess either something goes amiss during the download of the dictionaries by the browser from my server, or zlib doesn't work correctly in my browser, though both would probably be unrelated to kuroshiro. I am not using any bundler or webpack. I installed kuroshiro with bower and tried including it with a script-tag directly into the html page, as well as importing it as an ES6-module in a script of my own. Everything had the same result. I'll try playing around with the zlib library itself, to look how it works in my environment. |
Also look into the browser you use which may cause the error. |
some server auto decompress .gz in response (ex: python django), so just modify kuromoji/src/loader/BrowserDictionaryLoader.js and build your own js BrowserDictionaryLoader.prototype.loadArrayBuffer = function (url, callback) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.responseType = "arraybuffer";
xhr.onload = function () {
if (this.status > 0 && this.status !== 200) {
callback(xhr.statusText, null);
return;
}
var arraybuffer = this.response;
//var gz = new zlib.Zlib.Gunzip(new Uint8Array(arraybuffer));
//var typed_array = gz.decompress();
callback(null, arraybuffer);
};
xhr.onerror = function (err) {
callback(err, null);
};
xhr.send();
}; |
the error is coming from this line of code
|
Hello,
When calling kuroshiro.init in the browser, I get this error :
where 36,5 can be replaced by several different pairs of numbers.
This error happens 12 times and resembles the one from #24 , but differs since the files are found, the dicPath is correct, and the file-sizes match. Using the same dictionary files works in Node.js.
I have installed kuroshiro using bower.
The text was updated successfully, but these errors were encountered: