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

Builder wont accept url to data folder in chrome extension #39

Open
ghost opened this issue Apr 15, 2020 · 1 comment
Open

Builder wont accept url to data folder in chrome extension #39

ghost opened this issue Apr 15, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 15, 2020

Im trying to use the library inside a chrome extension and when I set up the builder, I pass in a path to data made by chrome like this:

let builder = kuromoji
  .builder({ dicPath: chrome.extension.getURL("data/") })
  .build(function (err, tokenizer) {
    var path = tokenizer.tokenize("すもももももももものうち");
  });

However I get an error:

kuromoji.js:7724 Uncaught TypeError: Cannot read property 'lookup' of null
    at UnknownDictionary.lookup (kuromoji.js:7724)
    at ViterbiBuilder.build (kuromoji.js:8806)
    at Tokenizer.getLattice (kuromoji.js:6961)
    at Tokenizer.tokenizeForSentence (kuromoji.js:6916)
    at Tokenizer.tokenize (kuromoji.js:6907)
    at furigana.js:103
    at kuromoji.js:7010
    at kuromoji.js:8272
    at kuromoji.js:3876
    at kuromoji.js:475
@larvata
Copy link

larvata commented Apr 22, 2020

I created a chrome extension based on kuromoji too, it works well.
https://github.com/larvata/mirigana/blob/develop/src/background/background.js#L46

I guess you place the dict files in the wrong place.

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

1 participant