jieba 分词不显示日志

问题

每一次我用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.

这样的提示。怎么去除这些提示呢?

解决方案

import logging
jieba.setLogLevel(logging.INFO)

jieba.setLogLevel(20)

参考:

https://github.com/fxsjy/jieba/issues/529

原文地址:https://www.cnblogs.com/JohnRain/p/11095314.html