V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
rogwan
V2EX  ›  Python

chardet 检测编码出现错误,一般用什么方式纠正呢?

  •  
  •   rogwan · 2017-09-16 13:32:00 +08:00 · 1939 次点击
    这是一个创建于 2424 天前的主题,其中的信息可能已经有所发展或是发生改变。

    汉字编码的字符,识别出来是 Russian:

    {'encoding': 'ISO-8859-5', 'language': 'Russian', 'confidence': 0.21185371684458437}
    

    当然 confidence 也显示的很低的。出现这种 confidence 过低的情况,基本就是误判了,有什么方式纠正吗?

    2 条回复    2017-09-16 16:38:01 +08:00
    DoctorCat
        1
    DoctorCat  
       2017-09-16 13:47:36 +08:00
    只能优化算法了吧。
    官方给了个原理性的 paper 链接: http://www-archive.mozilla.org/projects/intl/UniversalCharsetDetection.html
    可以重点看看 GB2312 的 confidence 计算方式
    janxin
        2
    janxin  
       2017-09-16 16:38:01 +08:00 via iPhone
    要内容够多越多越准
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2749 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 15:26 · PVG 23:26 · LAX 08:26 · JFK 11:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.