fxsjy / jieba

结巴中文分词
MIT License
32.86k stars 6.71k forks source link

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

Open PapaMadeleine2022 opened 6 years ago

PapaMadeleine2022 commented 6 years ago

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

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

aqua7regia commented 6 years ago

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

PapaMadeleine2022 commented 6 years ago

@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'
oisc commented 6 years ago

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

PapaMadeleine2022 commented 6 years ago

@aqua7regia it works. thank you~~

gaoyangthu commented 6 years ago
jieba.setLogLevel(20)

import logging
jieba.setLogLevel(logging.INFO)
PapaMadeleine2022 commented 6 years ago

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

PapaMadeleine2022 commented 6 years ago

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

gaoyangthu commented 6 years ago

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

PapaMadeleine2022 commented 6 years ago

@gaoyangthu yes, thank you very much~~

Kong-Ye commented 1 year ago

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

有用,谢谢!

manother commented 1 year ago

邮件已收到~

chenchen333-dev commented 3 months ago

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