Error when calling kuroshiro init [invalid file signature] even though files are found

See original GitHub issue

Hello, When calling kuroshiro.init in the browser, I get this error :

Uncaught Error: invalid file signature:36,5
    at $.g (kuroshiro.js:9052)
    at XMLHttpRequest.xhr.onload (kuroshiro.js:7685)

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.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
toanlcgiftcommented, Sep 3, 2020

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();
};
0reactions
chinenviniciuscommented, Aug 6, 2022

Also look into the browser you use which may cause the error. @hexenq i have test in all browser im having the same issue. for a strange reason dict files is loading on index page . but when i go to other pages. this .dat.gz files doens load files at all. i get 404 not found error . this should be fixed. i dont think it has to do with my browser .

the error is coming from this line of code

},{"./TokenizerBuilder":4,"./dict/builder/DictionaryBuilder":14}],16:[function(require,module,exports){
"use strict";var zlib=require("zlibjs/bin/gunzip.min.js"),DictionaryLoader=require("./DictionaryLoader");function BrowserDictionaryLoader(r){DictionaryLoader.apply(this,[r])}BrowserDictionaryLoader.prototype=Object.create(DictionaryLoader.prototype),BrowserDictionaryLoader.prototype.loadArrayBuffer=function(r,e){var o=new XMLHttpRequest;o.open("GET",r,!0),o.responseType="arraybuffer",o.onload=function(){if(this.status>0&&200!==this.status)e(o.statusText,null);else{var r=this.response,t=new zlib.Zlib.Gunzip(new Uint8Array(r)).decompress();e(null,t.buffer)}},o.onerror=function(r){e(r,null)},o.send()},module.exports=BrowserDictionaryLoader;
Read more comments on GitHub >

github_iconTop Results From Across the Web

kuroshiro - Bountysource
Error when calling kuroshiro init [invalid file signature] even though files are ... the files are found, the dicPath is correct, and the...
Read more >
"Invalid signature file" when attempting to run a .jar
For those who got this error when trying to create a shaded uber-jar with maven-shade-plugin , the solution is to exclude manifest signature...
Read more >
Signature is invalid in react app - Web - Zoom Developer Forum
I have create an app, and followed the instruction found here ... Error Signature is invalid. Which version? 1.8.5. To Reproduce(If ...
Read more >
wjG - River Thames Conditions - Environment Agency - GOV.UK
Plato ku inget sanga ikuta, Calling tablet samsung. Kirlin carolinas llc, Lusitano27bc, Trident 14 hits offshore platform, Sister in love with brother, ...
Read more >
Climate Models and Their Evaluation - IPCC
demonstrated to be right or wrong, but the model itself should ... They found that the models with the smallest 20th-century error.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found