dart_jieba 1.0.1 copy "dart_jieba: ^1.0.1" to clipboard
dart_jieba: ^1.0.1 copied to clipboard

DaJieBa - Pure Dart Chinese text segmentation, a port of Python jieba with binary trie and delta-gzip compression.

example/dart_jieba_example.dart

import 'package:dart_jieba/dart_jieba.dart';

void main() {
  final jieba = JiebaSegmenter();

  // initializeSync() auto-detects dict.dgz (fast ~19ms) or dict.txt (slow ~1s)
  jieba.initializeSync();

  // Or specify a custom dictionary path:
  // jieba.initializeSync(dictPath: 'assets/dict.dgz'); // fast: binary trie
  // jieba.initializeSync(dictPath: 'assets/dict.txt'); // slow: text dict

  print(jieba.cut('我们都是好孩子'));
  print(jieba.cut('他来到了网易杭研大厦'));
  print(jieba.cut('我来到北京清华大学'));
  print(jieba.cut('小明硕士毕业于中国科学院计算所'));
  print(jieba.cutForSearch('我爱北京天安门'));
  print(jieba.cut('我来到北京清华大学', cutAll: true));
}
1
likes
150
points
182
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

DaJieBa - Pure Dart Chinese text segmentation, a port of Python jieba with binary trie and delta-gzip compression.

Repository (GitHub)
View/report issues

License

MIT (license)

More

Packages that depend on dart_jieba