kuroshiro
kuroshiro copied to clipboard
React Native init fails
import kuroshiro from 'kuroshiro';
kuroshiro.init(function (err) {
console.log(err);
//console.log(kuroshiro.convert('感じ取れたら手を繋ごう', { to: 'hiragana' }));
});
Maybe I need to import the dictionary manually. What should I do?
I'm not familiar with React Native. Maybe you put the dictionary files in a wrong default folder. Try specifying the dict path by setting dicPath
option when initiating kuroshiro.
Has anyone found a solution for this?
I have a similar error with Vue. Has anybody figured it out? I think that the problem is related to Webpack.
@hexenq I think that you should change the default dicPath. Developers are moving away from Bower and now use npm on the front-end. Also I don't understand why you added dist/dict
in the npmignore file.
I solved it by having a look at what the output of the module bundler was and by making sure that the file path to the dictionary was correct.
@mornir How to fix it
@zi6xuan I've updated the readme (see section about module bundlers). Basically, you need to set the dicPath to a folder that is not processed by your module bundler.
@mornir Can you help me find out what the problem is? I use kuroshiro as the react-native ios
@zi6xuan Sorry, I'm not familiar with React Native. But this definitely looks like a problem with your bundle output.
Thanks for your reply, I thought you are also a reactinative developer
I'm working on the next major version of kuroshiro that will use rollup to bundle up the main module of kuroshiro, which may get this issue solved.
Hello everyone. The new major version of kuroshiro has been released. And the latest version is 1.1.0 which supports multiple morphological analyzers and different romanization systems. Give it a try. 😉
@mornir Hi, I noticed that you said it worked with Vue, Have you ever tried it with nativescript-vue? I have got a similar errors while using it with nativescript-vue. It seems kuroshiro is not working well with webpack. Any suggestions?
shilik
@shilik Sorry, I didn't try using it with nativescript-vue. Yes, you need a special Weback pack loader to process the dictionaries files. But I wasn't able to properly configure Webpack. So I just imported the dictionaries directly, without going through Webpack.