spaCy/spacy/zh/__init__.py
Yu-chun Huang 7692b8c071 Update __init__.py
Set the "cut_all" parameter to False, or jieba will return ALL POSSIBLE word segmentations.
2017-09-12 16:23:47 +08:00

13 lines
315 B
Python

from ..language import Language
from ..tokens import Doc
class Chinese(Language):
lang = u'zh'
def make_doc(self, text):
import jieba
words = list(jieba.cut(text, cut_all=False))
words=[x for x in words if x]
return Doc(self.vocab, words=words, spaces=[False]*len(words))