From 532318e80b8cd44b7d28a0460786ccfe9ce02919 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 2 Nov 2016 23:49:19 +0100 Subject: [PATCH] Import Jieba inside zh.make_doc --- spacy/zh/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spacy/zh/__init__.py b/spacy/zh/__init__.py index 3f4e36207..1847a7d8d 100644 --- a/spacy/zh/__init__.py +++ b/spacy/zh/__init__.py @@ -1,5 +1,3 @@ -import jieba - from ..language import Language from ..tokens import Doc @@ -8,5 +6,6 @@ class Chinese(Language): lang = u'zh' def make_doc(self, text): + import jieba words = list(jieba.cut(text, cut_all=True)) return Doc(self.vocab, words=words, spaces=[False]*len(words))