Skip to content

shove70/jieba

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status GitHub tag Dub downloads

Jieba chinese word segmentation D Deimos Bindings.

Reference:

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();

About

D version of Jieba Chinese word segmentation.

Resources

License

Stars

Watchers

Forks

Packages

No packages published