kuroshiro icon indicating copy to clipboard operation
kuroshiro copied to clipboard

React Native init fails

Open baijunjie opened this issue 6 years ago • 13 comments

import kuroshiro from 'kuroshiro';
kuroshiro.init(function (err) {
    console.log(err);
    //console.log(kuroshiro.convert('感じ取れたら手を繋ごう', { to: 'hiragana' }));
});

6c8056ef-42ea-419a-a818-5151f44a1058

Maybe I need to import the dictionary manually. What should I do?

baijunjie avatar Sep 19 '17 15:09 baijunjie

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.

hexenq avatar Nov 21 '17 03:11 hexenq

Has anyone found a solution for this?

alexwasner avatar Feb 03 '18 20:02 alexwasner

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.

mornir avatar Apr 19 '18 16:04 mornir

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 avatar Apr 21 '18 09:04 mornir

@mornir How to fix it

zi6xuan avatar Apr 23 '18 06:04 zi6xuan

@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 avatar Apr 23 '18 10:04 mornir

simulator screen shot - iphone 6 - 2018-04-23 at 21 53 09 @mornir Can you help me find out what the problem is? I use kuroshiro as the react-native ios

zi6xuan avatar Apr 23 '18 12:04 zi6xuan

@zi6xuan Sorry, I'm not familiar with React Native. But this definitely looks like a problem with your bundle output.

mornir avatar Apr 23 '18 14:04 mornir

Thanks for your reply, I thought you are also a reactinative developer

zi6xuan avatar Apr 24 '18 03:04 zi6xuan

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.

hexenq avatar May 16 '18 07:05 hexenq

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. 😉

hexenq avatar Aug 13 '18 08:08 hexenq

@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 avatar Oct 31 '18 03:10 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.

mornir avatar Nov 17 '18 07:11 mornir