Import Jieba inside zh.make_doc

This commit is contained in:
Matthew Honnibal 2016-11-02 23:49:19 +01:00
parent f292f7f0e6
commit 532318e80b

View File

@ -1,5 +1,3 @@
import jieba
from ..language import Language from ..language import Language
from ..tokens import Doc from ..tokens import Doc
@ -8,5 +6,6 @@ class Chinese(Language):
lang = u'zh' lang = u'zh'
def make_doc(self, text): def make_doc(self, text):
import jieba
words = list(jieba.cut(text, cut_all=True)) words = list(jieba.cut(text, cut_all=True))
return Doc(self.vocab, words=words, spaces=[False]*len(words)) return Doc(self.vocab, words=words, spaces=[False]*len(words))