mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-29 11:26:28 +03:00
669bd14213
remove the empty string return from jieba.cut,this will cause the list of tokens cant be pushed assert error
13 lines
314 B
Python
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))
|