- Notifications
You must be signed in to change notification settings - Fork2
Async Japanese Tokenizer Native Plugin for React Native for iOS and Android
License
craftzdog/react-native-japanese-tokenizer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Async Japanese tokenizer native plugin for React Native that works on iOS and Android.It tokenizes Japanese text in background thread so it won't block UI. It comes in handy for such as indexing a lot of texts for full-text search.
It utilizesCFStringTokenizer
to tokenize strings into words.
The implementation is based onTinySegmenter. It is lightweight word segmenter which works without dictionaries.
$ npm install react-native-japanese-tokenizer --save
$ react-native link react-native-japanese-tokenizer
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-japanese-tokenizer
and addRNJapaneseTokenizer.xcodeproj
- In Xcode, in the project navigator, select your project. Add
libRNJapaneseTokenizer.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import dog.craftz.japanese_tokenizer.RNJapaneseTokenizerPackage;
to the imports at the top of the file - Add
new RNJapaneseTokenizerPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-japanese-tokenizer'project(':react-native-japanese-tokenizer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-japanese-tokenizer/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-japanese-tokenizer')
UsingPromise
:
importTokenizerfrom'react-native-japanese-tokenizer'vartext="週休七日で働きたい"Tokenizer.tokenize(text).then(tokens=>{ ...})
async/await
:
importTokenizerfrom'react-native-japanese-tokenizer'vartext="週休七日で働きたい"consttokens=awaitTokenizer.tokenize(text)
Also check outthe test to learn more.
MIT License. By Takuya Matsuyama (@craftzdog).
Note that this module is based on following libraries with respective license. Thank you for the fantastic works!
- TinySegmenter: Javascriptだけで実装されたコンパクトな分かち書きソフトウェア
- BSD-3-Clause
- TinySegmenter for Java by takscape
- Public Domain
About
Async Japanese Tokenizer Native Plugin for React Native for iOS and Android
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.