jieba 0.0.3

Jieba chinese word segmentation D Deimos Bindings.


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

Manual usage
Put the following dependency into your project's dependences section:

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.3 2020-Oct-14
0.0.2 2019-Nov-14
0.0.1 2019-Sep-21
~master 2020-Oct-14
Show all 4 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 0 downloads total

Score:
0.0
Short URL:
jieba.dub.pm