位置: IT常识 - 正文

NLP工具集:【doccano】——标注平台doccano使用手册(nlp工具箱)

编辑:rootadmin
NLP工具集:【doccano】——标注平台doccano使用手册 一. 简介

推荐整理分享NLP工具集:【doccano】——标注平台doccano使用手册(nlp工具箱),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:nlp功能是什么,nlp工程,nlp常用工具,nlp tool,nlp工具包,nlp工具箱,nlp常用工具,nlp 工具,内容如对您有帮助,希望把文章链接给更多的朋友!

doccano 是一个开源的文本标注平台。它为文本分类、序列标记和序列到序列任务提供标注功能。因此,您可以为情感分析、命名实体识别、文本摘要、机器翻译等任务创建标注数据。只需创建一个项目,上传数据并开始标注,您就可以在数小时内构建得到想要的数据集。

doccano特性:

合作标注:可以进行多人合作,分配标注任务。支持多种语言文本标注:目前已知知识英语,中文,日语,阿拉伯语,印度尼西亚语等。二. 安装及使用

docker安装比较简单,这里只给出docker安装方式:

Step 1.镜像下载

镜像好比面向对象语言中的类。

docker pull doccano/doccanoStep 2.创建容器

容器就是镜像对应的实例化对象。

docker container create --name doccano \-e "ADMIN_USERNAME=admin" \-e "ADMIN_EMAIL=admin@example.com" \-e "ADMIN_PASSWORD=123456" \-v doccano-db:/data \-p 8000:8000 doccano/doccano

其中的各参数意义如下:

–name doccano 表示 创建的容器名称为doccano-e “ADMIN_USERNAME=admin” doccano项目中管理员账号为admin-e “ADMIN_EMAIL=admin@example.com” doccano项目中管理员的联系邮箱为admin@example.com-e “ADMIN_PASSWORD=password” doccano项目中管理员登陆密码password-v doccano-db:/data 项目中的数据挂在到宿主机地址到/data中-p 8000:8000 宿主机(前)与容器中端口之间的映射doccano/doccano 镜像名称Step 3.启动容器docker container start doccanoStep 4.浏览器访问

用户通过浏览器访问部署的服务器ip加上对应的端口号即可访问: 这里咱们输入:http://10.6.16.96:8000/

NLP工具集:【doccano】——标注平台doccano使用手册(nlp工具箱)

点击右上角进行登录

三. 数据标注1.项目创建

以农业花生数据标注任务为例:

2.数据上传

3.标签构建创建实体标签

创建关系标签

4.任务标注

关系标注时需要依次在头,尾实体Tag上点击鼠标左键才会出现可用关系选项

标注结果

5.数据导出

导出后的数据格式如下:

6.数据转换

抽取式任务数据转换:

当标注完成后,在 doccano 平台上导出 JSONL(relation) 形式的文件,并将其重命名为 doccano_ext.json 后,放入 ./data 目录下。通过 doccano.py 脚本进行数据形式转换,然后便可以开始进行相应模型训练。 doccano.py代码如下:import osimport timeimport argparseimport jsonimport numpy as npfrom utils import set_seed, convert_ext_examples, convert_cls_examplesdef do_convert(): set_seed(args.seed) tic_time = time.time() if not os.path.exists(args.doccano_file): raise ValueError("Please input the correct path of doccano file.") if not os.path.exists(args.save_dir): os.makedirs(args.save_dir) if len(args.splits) != 0 and len(args.splits) != 3: raise ValueError("Only []/ len(splits)==3 accepted for splits.") if args.splits and sum(args.splits) != 1: raise ValueError( "Please set correct splits, sum of elements in splits should be equal to 1." ) with open(args.doccano_file, "r", encoding="utf-8") as f: raw_examples = f.readlines() def _create_ext_examples(examples, negative_ratio=0, shuffle=False, is_train=True): entities, relations = convert_ext_examples( examples, negative_ratio, is_train=is_train) examples = entities + relations if shuffle: indexes = np.random.permutation(len(examples)) examples = [examples[i] for i in indexes] return examples def _create_cls_examples(examples, prompt_prefix, options, shuffle=False): examples = convert_cls_examples(examples, prompt_prefix, options) if shuffle: indexes = np.random.permutation(len(examples)) examples = [examples[i] for i in indexes] return examples def _save_examples(save_dir, file_name, examples): count = 0 save_path = os.path.join(save_dir, file_name) with open(save_path, "w", encoding="utf-8") as f: for example in examples: f.write(json.dumps(example, ensure_ascii=False) + "\n") count += 1 print("\nSave %d examples to %s." % (count, save_path)) if len(args.splits) == 0: if args.task_type == "ext": examples = _create_ext_examples(raw_examples, args.negative_ratio, args.is_shuffle) else: examples = _create_cls_examples(raw_examples, args.prompt_prefix, args.options, args.is_shuffle) _save_examples(args.save_dir, "train.txt", examples) else: if args.is_shuffle: indexes = np.random.permutation(len(raw_examples)) raw_examples = [raw_examples[i] for i in indexes] i1, i2, _ = args.splits p1 = int(len(raw_examples) * i1) p2 = int(len(raw_examples) * (i1 + i2)) if args.task_type == "ext": train_examples = _create_ext_examples( raw_examples[:p1], args.negative_ratio, args.is_shuffle) dev_examples = _create_ext_examples( raw_examples[p1:p2], -1, is_train=False) test_examples = _create_ext_examples( raw_examples[p2:], -1, is_train=False) else: train_examples = _create_cls_examples( raw_examples[:p1], args.prompt_prefix, args.options) dev_examples = _create_cls_examples( raw_examples[p1:p2], args.prompt_prefix, args.options) test_examples = _create_cls_examples( raw_examples[p2:], args.prompt_prefix, args.options) _save_examples(args.save_dir, "train.txt", train_examples) _save_examples(args.save_dir, "dev.txt", dev_examples) _save_examples(args.save_dir, "test.txt", test_examples) print('Finished! It takes %.2f seconds' % (time.time() - tic_time))if __name__ == "__main__": # yapf: disable parser = argparse.ArgumentParser() parser.add_argument("--doccano_file", default=r"../data/doccano_ext.json", type=str, help="The doccano file exported from doccano platform.") parser.add_argument("--save_dir", default=r"../data", type=str, help="The path of data that you wanna save.") parser.add_argument("--negative_ratio", default=5, type=int, help="Used only for the extraction task, the ratio of positive and negative samples, number of negtive samples = negative_ratio * number of positive samples") parser.add_argument("--splits", default=[0.8, 0.1, 0.1], type=float, nargs="*", help="The ratio of samples in datasets. [0.6, 0.2, 0.2] means 60% samples used for training, 20% for evaluation and 20% for test.") parser.add_argument("--task_type", choices=['ext', 'cls'], default="ext", type=str, help="Select task type, ext for the extraction task and cls for the classification task, defaults to ext.") parser.add_argument("--options", default=["正向", "负向"], type=str, nargs="+", help="Used only for the classification task, the options for classification") parser.add_argument("--prompt_prefix", default="情感倾向", type=str, help="Used only for the classification task, the prompt prefix for classification") parser.add_argument("--is_shuffle", default=True, type=bool, help="Whether to shuffle the labeled dataset, defaults to True.") parser.add_argument("--seed", type=int, default=1000, help="random seed for initialization") args = parser.parse_args() # yapf: enable do_convert()附录

doccano标准平台官方代码:https://github.com/doccano/doccano doccano标准平台官方文档:https://doccano.github.io/doccano/

本文链接地址:https://www.jiuchutong.com/zhishi/289575.html 转载请保留说明!

上一篇:应收账款清查采用的方法(应收账款清查采用实地盘点法)

下一篇:ant design pro项目安装以及坑点和大部分可能出现问题总结(ant design pro项目构建纯净版)

  • 微信屏幕黑色怎么回事(微信屏幕黑色怎么设置)

    微信屏幕黑色怎么回事(微信屏幕黑色怎么设置)

  • 抖音被限流了多久恢复(抖音被限流了多长时间能放开)

    抖音被限流了多久恢复(抖音被限流了多长时间能放开)

  • 申请抖音号必须要手机号码吗(申请抖音号必须实名认证吗)

    申请抖音号必须要手机号码吗(申请抖音号必须实名认证吗)

  • 华为nova7怎么截屏(华为Nova7怎么截图锁屏壁纸)

    华为nova7怎么截屏(华为Nova7怎么截图锁屏壁纸)

  • h55主板支持什么cpu(h55主板什么时候上市的)

    h55主板支持什么cpu(h55主板什么时候上市的)

  • 探探禁言多久自动解封(探探禁言几天)

    探探禁言多久自动解封(探探禁言几天)

  • 双11最迟发货时间是多少(双十一发货最迟多少天可以要求补偿)

    双11最迟发货时间是多少(双十一发货最迟多少天可以要求补偿)

  • 无线耳机一直亮红灯(无线耳机一直亮绿灯为什么啊)

    无线耳机一直亮红灯(无线耳机一直亮绿灯为什么啊)

  • 照片放qq相册占内存吗(照片放在qq相册里占空间吗)

    照片放qq相册占内存吗(照片放在qq相册里占空间吗)

  • oppofindx充电多少瓦(oppofindx标准版充电速度)

    oppofindx充电多少瓦(oppofindx标准版充电速度)

  • qq3g在线到底在不在线(手机qq3g在线是什么意思)

    qq3g在线到底在不在线(手机qq3g在线是什么意思)

  • 怎么把word保存在桌面上(怎么把word保存到桌面)

    怎么把word保存在桌面上(怎么把word保存到桌面)

  • ps如何把烟雾抠出来(ps如何把烟雾抠到图上)

    ps如何把烟雾抠出来(ps如何把烟雾抠到图上)

  • 怎么查看情侣空间历史(怎么查看情侣空间历史记录所有的前任)

    怎么查看情侣空间历史(怎么查看情侣空间历史记录所有的前任)

  • app开发有什么用(app开发是干什么的)

    app开发有什么用(app开发是干什么的)

  • 小米mix3如何设置滑盖(小米mix3如何设置软件不自动更新)

    小米mix3如何设置滑盖(小米mix3如何设置软件不自动更新)

  • 微博红包可以定时发送吗(微博红包可以买东西吗)

    微博红包可以定时发送吗(微博红包可以买东西吗)

  • 怎样彻底删除快手好友(怎样彻底删除快手里的好友)

    怎样彻底删除快手好友(怎样彻底删除快手里的好友)

  • 金立gn9012什么型号(金立gn9010是什么型号)

    金立gn9012什么型号(金立gn9010是什么型号)

  • netframework4.8安装失败解决方法(netframework4.8安装未成功)

    netframework4.8安装失败解决方法(netframework4.8安装未成功)

  • Linux系统中tr命令的基本使用教程(linux tr)

    Linux系统中tr命令的基本使用教程(linux tr)

  • 这是我见过最牛逼的滑动加载前端框架(这是我见过最牛的人英语)

    这是我见过最牛逼的滑动加载前端框架(这是我见过最牛的人英语)

  • 记 vue-cli-plugin-dll 使用,优化vue-cli项目构建打包速度

    记 vue-cli-plugin-dll 使用,优化vue-cli项目构建打包速度

  • 一般纳税人的现金收入
  • 增值税调整 以前签的合同怎么办?
  • 广东通用机打发票可以抵扣吗
  • 股权转让和变更法人一样吗?
  • 销售佣金计入什么会计科目
  • 收取租车押金怎么做会计分录
  • 同业清算交易渠道
  • 负数发票报税不让填怎么办
  • 个体工商年报怎么弄
  • 怎么填报清算所得税申报表?
  • 公司股东可以自己买保险吗
  • 营改增后书据转移印花税是含税的吗?
  • 小规模纳税人变成一般纳税人的条件
  • 建筑公司工地买空调
  • 装修行业属于什么行业分类
  • 企业法人和股份的关系
  • 小微企业减免税代码是多少
  • 记账凭证需要哪些人员签章
  • 专票的六位开票代码指的是什么
  • 开票金额与收入金额有差额可以吗
  • 房地产开发企业所得税管理办法
  • 子公司和母公司的财务关系
  • 最新企业会计准则
  • win10专业版技巧
  • appdata文件夹在用户文件夹哪里
  • win10关闭自动更新方法永久
  • Dardanup郡的小矮人村,澳大利亚 (© Amanda Hughes/Alamy)
  • php最好的教程
  • 消费税的会计分录怎么写
  • 收到厂家赠送商品入库
  • php操作步骤
  • 代理业务资产的核算方法
  • unity常用脚本语言
  • vue项目兼容ie9以上浏览器
  • 主动学习(Active Learning,AL)的理解以及代码流程讲解
  • 最新前端面试题
  • php判断手机浏览记录数据
  • 金融资产或金融负债满足下列条件之一
  • 纸质承兑上的印花是什么
  • 零税项目
  • 以前年度损益调整是什么意思
  • 预收账款期末余额在借方还是贷方
  • 企业主营业务利润是由什么构成的
  • 主营业务成本的摘要怎么写
  • 公司注销清算时个人股东如何计算个人所得税
  • 发票已开款未到的会计分录?
  • 公司名下汽车过户个人需要补税吗
  • 申请财产损失会计分录
  • 福利费需要发票吗
  • 电子发票已开出客户退款会计处理是怎样的?
  • 退回资金怎么做账
  • 退回的增值税税费怎么做会计记录
  • 内退文件2018
  • 固定资产清理账户的借方登记的项目有
  • 企业建账需做的会计科目
  • 物业管理企业应设置代管基金和代收款项账户
  • 序时账是明细账吗
  • 私企需要计提盈余公积吗
  • 获取sql表达式时错误
  • 如何快速找到注册的软件
  • 屏保 win7
  • centos安装完为什么没有桌面
  • Windows下查看PCI插槽链路
  • cocoscreator渲染流程图
  • cocos2djs教程
  • html上拉加载更多
  • 图像unit8
  • 怎样用在js中使用css的内容
  • cmd 远程登录
  • Javascript事件实例详解
  • python 进阶
  • 读取带敏感字符的行的批处理
  • 猫的合集
  • js定时器有哪些,区别及用法
  • android数据存储总结
  • 国家税务局网站发票验真伪
  • 新疆自治区国税局郑志全
  • 营业执照网上申报入口官网
  • 非盈利org
  • 如何查询有没有交医保费用
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设