位置: 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项目构建纯净版)

  • 压缩文件解压方法图解(压缩文件解压方式有什么区别)

    压缩文件解压方法图解(压缩文件解压方式有什么区别)

  • 连接itunes是什么意思

    连接itunes是什么意思

  • qq的定时说说在哪里(qq的定时说说在哪里找)

    qq的定时说说在哪里(qq的定时说说在哪里找)

  • 华为matebook13网络连不上怎么回事(华为matebook13网卡驱动下载)

    华为matebook13网络连不上怎么回事(华为matebook13网卡驱动下载)

  • 为什么iPhone不能提前激活(为什么iphone不能退出登录)

    为什么iPhone不能提前激活(为什么iphone不能退出登录)

  • 手机氧化怎么去除(手机氧化对手机有影响吗)

    手机氧化怎么去除(手机氧化对手机有影响吗)

  • 有赞申请退款多久到账(有赞退款退到哪里)

    有赞申请退款多久到账(有赞退款退到哪里)

  • 封口机不封口怎么回事(封口机不好用怎么办)

    封口机不封口怎么回事(封口机不好用怎么办)

  • nova6可以调空调吗(nova6能控制空调吗)

    nova6可以调空调吗(nova6能控制空调吗)

  • 华为流量校准失败怎么办(华为流量校准失败短信也发不过来)

    华为流量校准失败怎么办(华为流量校准失败短信也发不过来)

  • 手机卡能用多少年(手机卡能用多少年不用)

    手机卡能用多少年(手机卡能用多少年不用)

  • iphone xs max是什么手机(iphone xs max是什么时候出的)

    iphone xs max是什么手机(iphone xs max是什么时候出的)

  • 路由器频率5g和2.4的区别(路由器频率5g和2.4怎么设置)

    路由器频率5g和2.4的区别(路由器频率5g和2.4怎么设置)

  • 群账号限制使用什么意思(群被限制使用了)

    群账号限制使用什么意思(群被限制使用了)

  • 手机插卡的地方打不开怎么办(手机插卡的地方被牙签堵住了怎么办)

    手机插卡的地方打不开怎么办(手机插卡的地方被牙签堵住了怎么办)

  • 手机上的大文件能删吗(手机上的大文件视频怎么传到电脑上)

    手机上的大文件能删吗(手机上的大文件视频怎么传到电脑上)

  • 换热器一半热一半凉怎么回事(换热器为什么一半热另一半不热)

    换热器一半热一半凉怎么回事(换热器为什么一半热另一半不热)

  • 苹果7怎么信任软件开发者(苹果7怎么信任软件设置在哪里设置)

    苹果7怎么信任软件开发者(苹果7怎么信任软件设置在哪里设置)

  • 11pro max双卡怎么插(11pro max双卡怎么切换网络)

    11pro max双卡怎么插(11pro max双卡怎么切换网络)

  • 抖音小店购买记录怎么删除(抖音小店购买记录怎么查)

    抖音小店购买记录怎么删除(抖音小店购买记录怎么查)

  • 拼多多免单审核要多久(拼多多免单资格有成功过的么)

    拼多多免单审核要多久(拼多多免单资格有成功过的么)

  • 小米8掉电快怎么办(小米掉电快怎么补电)

    小米8掉电快怎么办(小米掉电快怎么补电)

  • 华为鸿蒙系统怎么取消华为账号授权? 鸿蒙取消授权的应用技巧(华为鸿蒙系统怎么降级版本)

    华为鸿蒙系统怎么取消华为账号授权? 鸿蒙取消授权的应用技巧(华为鸿蒙系统怎么降级版本)

  • 戛纳,法国 (© Manjik Photography/Alamy)

    戛纳,法国 (© Manjik Photography/Alamy)

  • 2023年美赛春季赛 赛题浅析(2023年美赛春季赛成绩查询)

    2023年美赛春季赛 赛题浅析(2023年美赛春季赛成绩查询)

  • 什么是企业增值税和所得税
  • 延期交税的情况有哪些
  • 购买材料,收回会计分录
  • 疫苗接种防疫站
  • 无形资产使用费计入什么科目
  • 外购货物用于捐赠的会计分录
  • 出售使用过的生产设备
  • 未实际处置资产怎么处理
  • 已认证的红字发票怎么退
  • 财产租赁所得应缴纳个人所得税
  • 转让部分股份流程
  • 取得转账支票后该如何处理
  • 进项税转出属于什么科目
  • 成本票最多开多少
  • 金税三期个人所得税扣缴系统手机版
  • 私账对私账不用交税吗
  • 营改增之前
  • 残保金中的工资总额在哪看
  • 对公账户长期不用怎么收费
  • 季报小微企业不包括哪些
  • 资产预测怎么写
  • 清理血管垃圾最有效的食物
  • 用于非应税项目的购进货物或应税劳务
  • 减免增值税的优惠政策
  • 表格怎样打印在一张a4纸上
  • 如何修复windows11无法的注册表值
  • 苹果客服人工24小时
  • 电脑bios启动项设置
  • bios读取不出u盘
  • 如何界定企业的收益
  • php 替换
  • 分摊本月领用材料的成本差异
  • 公司向私人借款利息可以入账吗
  • macbookappstore未知错误
  • 坏账准备期末余额怎么计算
  • 员工聚餐费用计入
  • php中的include
  • 股权投资的收益回收方式
  • 潘塔纳尔湿地的主要成因
  • 移动端h5页面适配
  • 老生常谈含义
  • php操作excel
  • htmlspecialchars_decode
  • css伪类选择器怎么用
  • 独立的分公司可以注册吗
  • 注销退税资格申请报告模板
  • 贷款减值准备怎么进损益类账户
  • 收取违约金能作为合同自动终止要件吗
  • 帝国cms使用手册
  • 二手车交易账务处理
  • SQL Server 2005 DTS导入平面数据出现错误解决方案
  • 土增清算可以扣除项目
  • 开票方没有缴纳增值税
  • 代收代缴的水电费怎么开票
  • 代理进口的增值税是多少
  • 成品油生产库存
  • 销售费用的会计分录摘要
  • 发票边上的孔有什么用
  • 母公司与子公司关系
  • 企业产值什么意思
  • 系统存储过程以什么为前缀
  • sql语句的查询语句
  • solaris date命令
  • aow进程
  • windows server 2016 域控
  • win10系统如何关闭屏保功能
  • windows 10的屏幕键盘快捷键在哪里
  • linux与windows有哪些主要区别
  • css中文名称
  • cocos2dx 3.2 Http网络连接,curl 库的介绍
  • 基于jquery实现小说
  • android studio代码写在哪
  • jquery的实现原理
  • 深圳小微企业税收优惠政策2023
  • 工行网银如何申请发票
  • 服务收入确认条件有哪些
  • 四川国税网上营业厅
  • 百旺数据恢复
  • 湖南电子税务申报
  • 商住两用房出售要交契税吗
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设