search

Home  >  Q&A  >  body text

python - jieba分词怎样 去掉或替换 默认词库里的词?

现在我cut

我想看电视

结果是

我 想 看电视

看了下默认的词库里有 看电视 这个词。。

我想搞成

我 想 看 电视
阿神阿神2910 days ago1170

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-04-18 09:53:40

    There is still a bug in the

    jieba.add_word method.
    jieba mainline has been fixed, but there may be
    in older versionsif freq改成if freq is not None

    because if freq is 0, there will be this bug🎜
    jieba.add_word("看电视",0)#或者jieba.del_word("看电视")
    jieba.add_word("看",100,"v")
    jieba.add_word("电视",100,"n")

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 09:53:40

    It’s very clear in the document
    Adjust the dictionary

    Features you need:

    reply
    0
  • Cancelreply