We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 40d5e02 commit 0afdb61Copy full SHA for 0afdb61
stanza/pipeline/external/jieba.py
@@ -3,6 +3,7 @@
3
"""
4
5
import re
6
+import warnings
7
8
from stanza.models.common import doc
9
from stanza.pipeline._constants import TOKENIZE
@@ -30,8 +31,12 @@ def __init__(self, config):
30
31
if config['lang'] not in ['zh', 'zh-hans', 'zh-hant']:
32
raise Exception("Jieba tokenizer is currently only allowed in Chinese (simplified or traditional) pipelines.")
33
- check_jieba()
34
- import jieba
+ # Surpress a DeprecationWarning about pkg_resource from jieba.
35
+ with warnings.catch_warnings():
36
+ warnings.filterwarnings("ignore", category=DeprecationWarning, module="jieba")
37
+ check_jieba()
38
+ import jieba
39
+
40
self.nlp = jieba
41
self.no_ssplit = config.get('no_ssplit', False)
42
0 commit comments