mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-14 21:57:15 +03:00
7692b8c071
Set the "cut_all" parameter to False, or jieba will return ALL POSSIBLE word segmentations.
13 lines
315 B
Python
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))
|