spaCy/spacy/zh/__init__.py
gispk47 669bd14213 Update __init__.py
remove the empty string return from jieba.cut,this will cause the list of tokens cant be pushed assert error
2017-07-01 13:12:00 +08:00

13 lines
314 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=True))
words=[x for x in words if x]
return Doc(self.vocab, words=words, spaces=[False]*len(words))