jieba
jieba copied to clipboard
怎么去除“Building prefix dict from the default dictionary ...”的提示
您好,每一次我用jieba进行分词的时候,都会有
Building prefix dict from the default dictionary ...
Loading model from cache /tmp/jieba.cache
Loading model cost 0.128 seconds.
Prefix dict has been built succesfully.
这样的提示。怎么去除这些提示呢?
找到jieba库的__init__.py, 大约28~30行左右,
log_console = logging.StreamHandler(sys.stderr)
default_logger = logging.getLogger(__name__)
default_logger.setLevel(logging.DEBUG)
default_logger.addHandler(log_console)
将default_logger.setLevel(logging.DEBUG)
改为 default_logger.setLevel(logging.INFO)
试试。
@oisc it shows error:
Traceback (most recent call last):
File "xxx.py", line 29, in <module>
jieba_logger.handlers.clear()
AttributeError: 'list' object has no attribute 'clear'
@IvyGongoogle
try del jieba_logger.handlers[:]
if you are using Python2
@aqua7regia it works. thank you~~
jieba.setLogLevel(20)
或
import logging
jieba.setLogLevel(logging.INFO)
@oisc sorry, What do you mean for del jieba_logger.handlers[:]?
@gaoyangthu it works, but It seems to be jieba.setLogLevel(logging.INFO)
@IvyGongoogle You're right! setLogLevel(0) equals setLogLevel(logging.NOTSET) setLogLevel(10) equals setLogLevel(logging.DEBUG) setLogLevel(20) equals setLogLevel(logging.INFO) setLogLevel(30) equals setLogLevel(logging.WARNING) setLogLevel(40) equals setLogLevel(logging.ERROR) setLogLevel(50) equals setLogLevel(logging.CRITICAL)
@gaoyangthu yes, thank you very much~~
找到jieba库的__init__.py, 大约28~30行左右,
log_console = logging.StreamHandler(sys.stderr) default_logger = logging.getLogger(__name__) default_logger.setLevel(logging.DEBUG) default_logger.addHandler(log_console)
将
default_logger.setLevel(logging.DEBUG)
改为default_logger.setLevel(logging.INFO)
试试。
有用,谢谢!
邮件已收到~
您好,每一次我用jieba进行分词的时候,都会有
Building prefix dict from the default dictionary ... Loading model from cache /tmp/jieba.cache Loading model cost 0.128 seconds. Prefix dict has been built succesfully.
这样的提示。怎么去除这些提示呢? 我微调训练的时候出现这个,然后就结束了,这是还没开始微调把?