jieba-hant

Traditional Chinese Words Segementation Utilities


Keywords
NLP, tokenizing, Chinese, word, segementation
License
MIT
Install
pip install jieba-hant==0.39.1

Documentation

jieba-hant

結巴(jieba)斷詞台灣繁體 特化版本, 為了防止版本相衝突,更改了套件名稱

原理

採用和原始jieba相同的演算法,替換其詞庫及HMM機率表製做出針對台灣繁體的jieba斷詞器

安裝

pip install jieba-hant

使用

本專案特化部分如下

import jieba_hant

jieba_hant.case_sensitive = True # 可控制對於詞彙中的英文部分是否為case sensitive, 預設False

斷詞

import jieba_hant

#如果您的電腦同時要使用兩個版本的jieba,請自訂cache檔名,避免兩個cache互相蓋住對方
#jieba.dt.cache_file = 'jieba.cache.new'

seg_list = jieba_hant.cut("新竹的交通大學在新竹的大學路上")
print(" / ".join(seg_list))
# 新竹 / 的 / 交通 / 大學 / 在 / 新竹 / 的 / 大學路 / 上 /

其餘操作請參考結巴官方文件

其餘注意事項

參考ldkrsi版本之說明