推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
python30
V2EX  ›  Python

django 结巴分词,和现有的 tag 取交集后得出来的词怎么添加到文章的 tags 里?

  •  
  •   python30 · Aug 24, 2019 · 2094 views
    This topic created in 2467 days ago, the information mentioned may be changed or developed.



    问题主要在这里,pctaglist 是在后台添加的 标签 tags,
    用 jieba 分词分析文章内容后得出来的词与这个后台添加的标签取交集。如果有就添加到这个文章的标签里!
    这里不知道怎么在这里添加,
    用 t.tags.add(word) 出错:'decimal' codec can't encode characters in position 0-1: invalid decimal Unicode string 我也觉得这里这样操作有问题.但是一时不知道怎么改.知识不够....

    要想实现 结巴分词,和现有的 tag 取交集后得出来的词怎么添加到文章的 tags 里?
    或者有其它的好办法实现这一步?

    谢谢~
    2 replies    2019-08-25 03:23:15 +08:00
    python30
        1
    python30  
    OP
       Aug 24, 2019
    这里贴代码不方便
    有空的朋友可以看看这贴里详细说明:
    https://segmentfault.com/q/1010000020173427
    指导一下。谢谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3070 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 128ms · UTC 14:39 · PVG 22:39 · LAX 07:39 · JFK 10:39
    ♥ Do have faith in what you're doing.