Modify jieba install message (#5328)

Modify jieba install message to instruct the user to use
`ChineseDefaults.use_jieba = False` so that it's possible to load
pkuseg-only models without jieba installed.
This commit is contained in:
adrianeboyd 2020-04-20 22:06:53 +02:00 committed by GitHub
parent b919844fce
commit bf5c13d170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -30,8 +30,10 @@ def try_jieba_import(use_jieba):
except ImportError: except ImportError:
if use_jieba: if use_jieba:
msg = ( msg = (
"Jieba not installed. Either set Chinese.use_jieba = False, " "Jieba not installed. Either set the default to False with "
"or install it https://github.com/fxsjy/jieba" "`from spacy.lang.zh import ChineseDefaults; ChineseDefaults.use_jieba = False`, "
"or install it with `pip install jieba` or from "
"https://github.com/fxsjy/jieba"
) )
raise ImportError(msg) raise ImportError(msg)