jieba icon indicating copy to clipboard operation
jieba copied to clipboard

怎么去除“Building prefix dict from the default dictionary ...”的提示

Open PapaMadeleine2022 opened this issue 7 years ago • 12 comments

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

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

PapaMadeleine2022 avatar Sep 28 '17 13:09 PapaMadeleine2022

找到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) 试试。

aqua7regia avatar Sep 29 '17 08:09 aqua7regia

@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'

PapaMadeleine2022 avatar Oct 16 '17 02:10 PapaMadeleine2022

@IvyGongoogle try del jieba_logger.handlers[:] if you are using Python2

oisc avatar Oct 16 '17 02:10 oisc

@aqua7regia it works. thank you~~

PapaMadeleine2022 avatar Oct 16 '17 02:10 PapaMadeleine2022

jieba.setLogLevel(20)

import logging
jieba.setLogLevel(logging.INFO)

gaoyangthu avatar Oct 16 '17 09:10 gaoyangthu

@oisc sorry, What do you mean for del jieba_logger.handlers[:]?

PapaMadeleine2022 avatar Oct 16 '17 13:10 PapaMadeleine2022

@gaoyangthu it works, but It seems to be jieba.setLogLevel(logging.INFO)

PapaMadeleine2022 avatar Oct 16 '17 13:10 PapaMadeleine2022

@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 avatar Oct 18 '17 00:10 gaoyangthu

@gaoyangthu yes, thank you very much~~

PapaMadeleine2022 avatar Oct 18 '17 03:10 PapaMadeleine2022

找到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) 试试。

有用,谢谢!

Kong-Ye avatar May 12 '23 09:05 Kong-Ye

邮件已收到~

manother avatar May 12 '23 09:05 manother

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

这样的提示。怎么去除这些提示呢? 我微调训练的时候出现这个,然后就结束了,这是还没开始微调把? image

chenchen333-dev avatar Apr 10 '24 09:04 chenchen333-dev