mecab_for_flutter 1.0.2 copy "mecab_for_flutter: ^1.0.2" to clipboard
mecab_for_flutter: ^1.0.2 copied to clipboard

Flutter plugin which provides binding to Mecab library (Japanese Morphological Analyzer)

mecab_for_flutter #

MeCab(Japanese Morphological Analyzer) bindings for flutter on all platforms. Try it out in the browser!.

Android iOS Windows MacOS Linux Web Web --wasm

Installation #

  1. Add this plug_in as a dependency in your pubspec.yaml file.
dependencies:   
   mecab_for_flutter: <your_version> 

Libraries #

Native platforms #

On dart:io platforms this plugin ships with the necessary mecab binaries.

Web #

On web this package expects that the libraries are in assets/blobs/. Alternatively, the init constructor can be used with a custom path. You can get a precompiled version here.

For more details about the binaries see

Example #

Init Mecab:

var tagger = new Mecab();
await tagger.initFlutter("path/to/your/dictionary/", true);

Set the boolean option in init function to true if you want to get the tokens including features, set it to false if you only want the token surfaces.

Use the tagger to parse text:

var tokens = tagger.parse('にわにわにわにわとりがいる。');
var text = '';

for(var token in tokens) {
  text += token.surface + "\t";
  for(var i = 0; i < token.features.length; i++) {
    text += token.features[i];
    if(i + 1 < token.features.length) {
       text += ",";
    }
  }
  text += "\n";
}

For a more detailed example see the ./example/.

0
likes
0
points
238
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin which provides binding to Mecab library (Japanese Morphological Analyzer)

Repository (GitHub)
View/report issues

Funding

Consider supporting this project:

github.com
buymeacoffee.com
www.patreon.com

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, mecab_for_dart, path, universal_ffi, universal_io

More

Packages that depend on mecab_for_flutter