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

  • 空调制热效果差是咋回事(空调制热效果差的原因)(空调制热效果差是什么原因造成的)

    空调制热效果差是咋回事(空调制热效果差的原因)(空调制热效果差是什么原因造成的)

  • 手机wps文件夹怎么压缩打包发送(手机Wps文件夹怎么添加文件)

    手机wps文件夹怎么压缩打包发送(手机Wps文件夹怎么添加文件)

  • 微信防误触怎么关闭(微信防误触怎么开)

    微信防误触怎么关闭(微信防误触怎么开)

  • 手机相册里的照片误删怎么恢复(手机相册里的照片会泄露吗)

    手机相册里的照片误删怎么恢复(手机相册里的照片会泄露吗)

  • 数据由泰迪熊提供是什么意思(数据由泰迪熊提供的,是不是都是诈骗电话?)

    数据由泰迪熊提供是什么意思(数据由泰迪熊提供的,是不是都是诈骗电话?)

  • 腾讯会议直播可以回放吗(腾讯会议直播可以看到观看时长吗)

    腾讯会议直播可以回放吗(腾讯会议直播可以看到观看时长吗)

  • 一个计算机操作系统通常具有的功能模块是(计算机上机操作)

    一个计算机操作系统通常具有的功能模块是(计算机上机操作)

  • 小盒学生在电脑上怎么下载(小盒学生在电脑上下载)

    小盒学生在电脑上怎么下载(小盒学生在电脑上下载)

  • 外接显示器不能满屏(外接显示器不能复制)

    外接显示器不能满屏(外接显示器不能复制)

  • 计算机系统硬件组成有(计算机系统硬件由哪几部分组成)

    计算机系统硬件组成有(计算机系统硬件由哪几部分组成)

  • 关闭文档快捷键(关闭当前文档的快捷键是)

    关闭文档快捷键(关闭当前文档的快捷键是)

  • 手机如何上pixiv(手机如何上传照片到电脑)

    手机如何上pixiv(手机如何上传照片到电脑)

  • 微信记录怎么查(查对方微信记录怎么查)

    微信记录怎么查(查对方微信记录怎么查)

  • 拼多多拒收会退款吗(拼多多拒收退回怎么处理)

    拼多多拒收会退款吗(拼多多拒收退回怎么处理)

  • 手机屏幕发绿怎么回事(手机屏幕发绿怎么调色温)

    手机屏幕发绿怎么回事(手机屏幕发绿怎么调色温)

  • 浏览器里的收藏怎么找(浏览器里的收藏同步怎么关闭)

    浏览器里的收藏怎么找(浏览器里的收藏同步怎么关闭)

  • 爱奇艺怎么上传图片(爱奇艺怎么上传短视频)

    爱奇艺怎么上传图片(爱奇艺怎么上传短视频)

  • 滴滴深夜服务是几点到几点(滴滴深夜服务价格)

    滴滴深夜服务是几点到几点(滴滴深夜服务价格)

  • kindle paperwhite 4和3的区别

    kindle paperwhite 4和3的区别

  • 交易猫协议保障怎么弄(交易猫协议保障下架)

    交易猫协议保障怎么弄(交易猫协议保障下架)

  • 为什么别人加我qq没有提示(为什么别人加我微信提示异常,对身份进行验证)

    为什么别人加我qq没有提示(为什么别人加我微信提示异常,对身份进行验证)

  • qq活动气泡是永久的吗(qq活动气泡过期了还能使用吗)

    qq活动气泡是永久的吗(qq活动气泡过期了还能使用吗)

  • 安卓手机拦截功能在哪(安卓手机拦截功能在哪里关闭)

    安卓手机拦截功能在哪(安卓手机拦截功能在哪里关闭)

  • Typescript 全栈最值得学习的技术栈 TRPC(typescript完全解读)

    Typescript 全栈最值得学习的技术栈 TRPC(typescript完全解读)

  • dpkg-deb命令  deb软件包管理器(dpkg -s命令)

    dpkg-deb命令 deb软件包管理器(dpkg -s命令)

  • 个税专项扣除能中途新增
  • 应交税费负数调整到其他非流动资产
  • 生产企业出口货物劳务免抵退税申报明细表
  • 预缴增值税的会计账务处理
  • 支付境外技术服务费代扣代缴所得税账务处理
  • 企业理财收入如何确定
  • 增值税转型的主要内容
  • 应收账款计提坏账比例
  • 所有的企业都能采用免费策略
  • 个人公司转让协议怎么写
  • 开具增值税专用发票承诺函
  • 增值税进项税额转出是什么意思
  • 待抵扣进项税额是什么情况下用的
  • gdp等于消费加储蓄加税收
  • 公司房租可以抵多少税
  • 实际缴纳的增值税比计提的多
  • 工会经费怎么做账务处理
  • 缴纳的教育费附加可以税前扣除吗
  • 增值税普通发票税率
  • 机械租赁有什么机械
  • 无法收回的款项摘要怎么写
  • 股东能随便提走入账资金吗
  • Win10 20H2 Beta 预览版 19042.782正式推送(附更新内容)
  • 税收筹划的原则包括
  • 股权转让个人所得税优惠政策
  • php getdate
  • 龙舌兰 (© Moab Republic/Shutterstock)
  • 蓝山公馆的房子怎么样
  • 基于php技术
  • php页面跳转方法
  • 保税进料加工企业
  • js创建对象的三种方式
  • python打开文本文档中文读不出来
  • 印花税账务处理会计分录
  • 小规模工程服务开票几个点
  • 税务稽查补税
  • 技术服务费增值税税率1%
  • 债转股需要哪些资料
  • 微擎框架是开源的吗
  • 购入固定资产的预算会计账务处理
  • 专项应付款的账务处理
  • 开票只开大类
  • sql中的row_number
  • SQL查询中in和exists的区别分析
  • 企业所得税汇算清缴扣除标准2023
  • 采购原材料未入库
  • 职业年金是不是养老保险
  • 递延所得税资产和负债账务处理
  • 承兑汇票多付退税怎么算
  • 个税里的年金是指
  • 技术合同免税备案流程
  • 伤残就业补偿金记入什么科目
  • sqlserver查询所有表的行数
  • mysql多表内连接查询
  • sql多表连接查询
  • win10禁用系统uac
  • 服务器远程超出配置范围
  • win2003取消自动锁定
  • gentoo linux优点
  • dwrg_repair.exe什么意思
  • linux防止攻击
  • win10 rs3
  • GHOST XP 安装教程
  • win10系统自带虚拟机无法启
  • win8右侧栏设置
  • Ubuntu 下搭建网站服务器
  • unity3d ngui-TweenRotation翻牌动画
  • Unity3D Editor类(Inspector) 编写经验总结
  • 在img标签中的alt属性里添加内容可以告诉
  • shell命令读取文件并新增另一文件到指定行
  • js获取对象key的方式有哪些
  • jquery页面跳转的方法
  • jquery.flot
  • js添加一个div
  • 收到海关进口增值税专用缴款书怎么确定库存商品的金额
  • 小规模无票收入怎么报税
  • 如何查询甘肃省清产核资系统扶贫项目资产金额
  • 回迁房办房产证需要交多少钱
  • 九江五室新楼盘
  • 欠税多少构成犯罪
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设