jieba 0.0.1

Jieba chinese word segmentation D Deimos Bindings.


To use this package, run the following command in your project's root directory:

Build Status GitHub tag Dub downloads

Jieba chinese word segmentation D Deimos Bindings.

Reference:

  • https://github.com/yanyiwu/cppjieba (upstream)
  • https://github.com/shove70/cppjieba/tree/shove (Fork, Add APIs)

Quick Start:

import std.string : toStringz;
import std.conv : to;
import std.stdio: writeln;

import deimos.jieba.jieba;

string dict_path = "./dict/jieba.dict.utf8";
string hmm_path = "./dict/hmm_model.utf8";
string user_dict_path = "./dict/user.dict.utf8";
string idf_path = "./dict/idf.utf8";
string stop_word_path = "./dict/stop_words.utf8";

jieba_open(dict_path.toStringz, hmm_path.toStringz, user_dict_path.toStringz, idf_path.toStringz, stop_word_path.toStringz);

string s = "A chinese string";
size_t length;
AWord* words = jieba_cut(s.toStringz, true, &length);

for (size_t i = 0; i < length; i++)
{
    writeln(words[i].word.to!string);
}

jieba_free(words, length);
jieba_close();
Authors:
  • Shove
Dependencies:
none
Versions:
0.0.1 2019-Sep-21
~master 2019-Sep-21
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 5 downloads this week

  • 15 downloads this month

  • 15 downloads total

Score:
1.0
Short URL:
jieba.dub.pm