问题描述

目前找到的python库主要就是langid和langdetect,对两个库的识别准确率做了一下对比,测试集来自于机器翻译的测试集newstest2018
首先将sgm文件转成txt格式,去掉sgm格式的标记符,只保留文本内容
针对每个文件分别计算langid和langdetect的识别准确率,再将识别正确的数量加和除以总数量计算整体准确率

langid_total = []
langdectect_total = []
data_total = []
path_set = os.listdir(dir_out)
for path in path_set:lang = path[-6:-4]langid_acc = 0langdectect_acc = 0with open( os.path.join(dir_out, path), encoding='utf-8') as f:data = f.readlines()for i in data:try:a = identifier.classify(i)if a[0] == lang:langid_acc +=1b = detect(i)if if (b == lang) or (b=='zh-cn' and lang=='zh'):langdectect_acc +=1except:passprint('%s :langid accuracy %f , langdetect accuracy %f' % (path, langid_acc/len(data), langdectect_acc/len(data)))langid_total.append(langid_acc)langdectect_total.append(langdectect_acc)data_total.append(len(data))
print('toatal :langid accuracy %f , langdetect accuracy %f' % (sum(langid_total)/sum(data_total), sum(langdectect_total)/sum(data_total)))

实验结果

langid 略高于langdetect, 在不同语种上互有胜负

newstest2018-csen-ref.en.txt :langid accuracy 0.987932 , langdetect accuracy 0.989273
newstest2018-csen-src.cs.txt :langid accuracy 0.966812 , langdetect accuracy 0.974187
newstest2018-deen-ref.en.txt :langid accuracy 0.991328 , langdetect accuracy 0.990994
newstest2018-deen-src.de.txt :langid accuracy 0.997332 , langdetect accuracy 0.992328
newstest2018-encs-ref.cs.txt :langid accuracy 0.966812 , langdetect accuracy 0.976198
newstest2018-encs-src.en.txt :langid accuracy 0.987932 , langdetect accuracy 0.988937
newstest2018-ende-ref.de.txt :langid accuracy 0.997332 , langdetect accuracy 0.992995
newstest2018-ende-src.en.txt :langid accuracy 0.991328 , langdetect accuracy 0.990994
newstest2018-enet-ref.et.txt :langid accuracy 0.980500 , langdetect accuracy 0.989500
newstest2018-enet-src.en.txt :langid accuracy 0.995500 , langdetect accuracy 0.991000
newstest2018-enfi-ref.fi.txt :langid accuracy 0.992667 , langdetect accuracy 0.996333
newstest2018-enfi-src.en.txt :langid accuracy 0.989667 , langdetect accuracy 0.987667
newstest2018-enru-ref.ru.txt :langid accuracy 0.971667 , langdetect accuracy 0.989667
newstest2018-enru-src.en.txt :langid accuracy 0.995667 , langdetect accuracy 0.993000
newstest2018-entr-ref.tr.txt :langid accuracy 0.978333 , langdetect accuracy 0.994333
newstest2018-entr-src.en.txt :langid accuracy 0.986000 , langdetect accuracy 0.981667
newstest2018-enzh-ref.zh.txt :langid accuracy 0.996483 , langdetect accuracy 0.941472
newstest2018-enzh-src.en.txt :langid accuracy 0.994474 , langdetect accuracy 0.989952
newstest2018-eten-ref.en.txt :langid accuracy 0.995500 , langdetect accuracy 0.991000
newstest2018-eten-src.et.txt :langid accuracy 0.980500 , langdetect accuracy 0.989000
newstest2018-fien-ref.en.txt :langid accuracy 0.989667 , langdetect accuracy 0.988000
newstest2018-fien-src.fi.txt :langid accuracy 0.992667 , langdetect accuracy 0.995333
newstest2018-ruen-ref.en.txt :langid accuracy 0.995667 , langdetect accuracy 0.992333
newstest2018-ruen-src.ru.txt :langid accuracy 0.971667 , langdetect accuracy 0.990000
newstest2018-tren-ref.en.txt :langid accuracy 0.986000 , langdetect accuracy 0.980000
newstest2018-tren-src.tr.txt :langid accuracy 0.978333 , langdetect accuracy 0.994000
newstest2018-zhen-ref.en.txt :langid accuracy 0.994474 , langdetect accuracy 0.989199
newstest2018-zhen-src.zh.txt :langid accuracy 0.996483 , langdetect accuracy 0.941472
toatal :langid accuracy 0.987811 , langdetect accuracy 0.984591

python 语种识别对比相关推荐

  1. python人脸识别对比_python 人脸对比--百度API人脸相似度识别(超简单)

    说明:这篇是写使用百度人脸识别API进行人脸相似度识别对比,如 给两个人物照片,判断是否是同一个人.简单的4步完成. 1,获取百度人脸识别API的API Key和Secret Key.(10分钟内完成 ...

  2. python人脸识别和人脸对比,face_recognition和OpenCV

    前言 先用OpenCV判断图片是否模糊,模糊的话需要重拍: 再用face_recognition检测图片中是否有人脸,有才接着进行下一步: 再用face_recognition计算图片中每张人脸的12 ...

  3. python 制定识别图片的某些区域_python批量识别图片指定区域文字内容

    Python批量识别图片指定区域文字内容,供大家参考,具体内容如下 简介 对于一张图片,需求识别指定区域的内容 1.截取原始图上的指定图片当做模板 2.根据模板相似度去再原始图片上识别准确坐标 3.根 ...

  4. python 人脸识别调整人脸大的距离_Python 人脸识别就多简单,看这个就够了!

    原标题:Python 人脸识别就多简单,看这个就够了! 今天给大家介绍一个世界上最简洁的人脸识别库 face_recognition,你可以使用 Python 和命令行工具进行提取.识别.操作人脸. ...

  5. Python人脸识别黑科技(二):教你使用python+Opencv完成人脸解锁

    继上一篇"Python人脸识别黑科技(一):50行代码运用Python+OpenCV实现人脸追踪+详细教程+快速入门+图像识",那么今天我们来讲关于使用python+opencv+ ...

  6. Python人脸识别——从入门到工程实践

    参考书籍:<Python人脸识别从入门到工程实践> 全书共8章: 第 1 章:介绍了人脸识别的基础知识和必备常识: 第 2~4 章:详细讲解了与人脸识别相关的数学.机器学习.计算机视觉.O ...

  7. 【优秀课设】基于OpenCV的Python人脸识别、检测、框选(遍历目录下所有照片依次识别 视频随时标注)

    基于OpenCV的Python人脸识别.检测.框选 (遍历目录下所有照片依次识别 视频随时标注) 移步: https://blog.csdn.net/weixin_53403301/article/d ...

  8. 人脸图像识别(python人脸识别技术)

    python人脸识别 人脸识别的崛起 什么是人脸识别 人脸识别技术的应用和发展 python人脸识别 导入库 实现代码 人脸识别的崛起 什么是人脸识别 人脸识别是将采集到的数据信息,根据人脸特征信息进 ...

  9. 基于python的文字识别系统,python神经网络识别图片

    如何快速使用Python神经网络识别手写字符 CNN卷积神经网络是一种深度模型.它其实老早就已经可以成功训练并且应用了(最近可能deeplearning太火了,CNNs也往这里面靠. 虽然CNNs也属 ...

  10. python人脸识别考勤系统 dlib+OpenCV和Pyqt5、数据库sqlite 人脸识别系统 计算机 毕业设计 源码

    一.项目介绍 Python语言.dlib.OpenCV.Pyqt5界面设计.sqlite3数据库 本系统使用dlib作为人脸识别工具,dlib提供一个方法可将人脸图片数据映射到128维度的空间向量,如 ...

最新文章

  1. 信号处理频谱分析中,如何选择合适的窗函数
  2. Python 创建和使用类
  3. linux中安装jdk安装(rpm安装)
  4. 虚拟机linux gedit,Linux系统中把gedit改造成TextMate的方法
  5. 研发项目wbs分解简单案例_2013项目管理案例分析:工作分解结构(WBS)(精选五篇)...
  6. 小米笔记本air13-3安装黑苹果macOS
  7. Python学习之Turtle库
  8. html5创建桌面快捷方式,iOS APP创建桌面快捷方式
  9. Android性能测试文章汇总
  10. spark常用的linux命令,GitHub - Sparkinzy/linux-command: Linux命令大全搜索工具,内容包含Linux命令手册、详解、学习、搜集。...
  11. 轻量级网络——MobileNet系列学习(理论篇)
  12. Python报错ReadTimeoutError
  13. 超乎想象!关于5G无人机的最强科普!
  14. 体验了一次DNS的动态更新功能
  15. 测试RADIUS服务器
  16. 北京2008年地铁规划收集
  17. 计算机 打印机型号编码不可用,打印机型号编码显示不可用
  18. flink keyby、shuffle、 rebalance、rescale、 broadcast、global、自定义分区算子以及各分区器源码
  19. CARLA 笔记(06)— Types of actors (Sensors、Spectator、Traffic signs and lights、Vehicles、Walkers)
  20. 退役大学生的IT求学之路

热门文章

  1. 【Matter】基于Ubuntu 22.04搭建matter开发环境:chip-tool 配网之 matter-over-wifi
  2. * MongoDB vs Redis vs Tokyo Tyrant
  3. Java 8 函数式替换if else动态执行实现代码
  4. oracle错误代码1861,Oracle行列转换
  5. 【沐风老师】推荐2023年3DMAX的10个最佳插件!
  6. tradeSeq | Slingshot下游 沿轨迹分析pathway表达
  7. 华为认证知识点之IPV6
  8. 【通俗易懂】vue同一个页面复用同一个组件多次,如何让组件的内容显示不一样
  9. Day001 自学Python的缘由-10年后,我想在北京买房
  10. 江苏省计算机二级c 上机试题,2010~2012年江苏省计算机二级C上级考试试题及答案上机.doc...