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

  • 小米手机怎么截长屏(小米手机怎么截长图)

    小米手机怎么截长屏(小米手机怎么截长图)

  • 苹果手机如何隐藏软件还可以正常使用(苹果手机如何隐藏应用软件)

    苹果手机如何隐藏软件还可以正常使用(苹果手机如何隐藏应用软件)

  • 11寸和12.9寸 pro 区别(11寸和12.9寸 pro 大小)

    11寸和12.9寸 pro 区别(11寸和12.9寸 pro 大小)

  • 手机qq特别关心提示音怎么关(手机qq特别关心查询)

    手机qq特别关心提示音怎么关(手机qq特别关心查询)

  • 微信发送语音界面不一样(微信发送语音界面怎么设置)

    微信发送语音界面不一样(微信发送语音界面怎么设置)

  • 新开淘宝店可以开通淘宝客吗(新开淘宝店可以自己打印快递单然后拿到站点寄吗)

    新开淘宝店可以开通淘宝客吗(新开淘宝店可以自己打印快递单然后拿到站点寄吗)

  • 手机wps文档分享不了到微信(手机WPS文档分享出去段落没了)

    手机wps文档分享不了到微信(手机WPS文档分享出去段落没了)

  • 怎么剪抖音同款(怎样剪抖音同款)

    怎么剪抖音同款(怎样剪抖音同款)

  • 超话屏蔽会自动解除吗(超话屏蔽会自动取关吗)

    超话屏蔽会自动解除吗(超话屏蔽会自动取关吗)

  • vivo手机sim卡管理在哪里(vivi手机sim卡装哪里)

    vivo手机sim卡管理在哪里(vivi手机sim卡装哪里)

  • 手机可以开通网上银行吗(手机可以开通网银怎么开通)

    手机可以开通网上银行吗(手机可以开通网银怎么开通)

  • 怎么把软件拷贝到u盘(如何将电脑文件拷贝到u盘)

    怎么把软件拷贝到u盘(如何将电脑文件拷贝到u盘)

  • 手机在线和2g在线区别(手机在线2g和在线2g)

    手机在线和2g在线区别(手机在线2g和在线2g)

  • 快手极速版怎么暂停播放(快手极速版怎么换绑提现微信)

    快手极速版怎么暂停播放(快手极速版怎么换绑提现微信)

  • 滴嗒出行怎么设置导航(滴嗒出行怎么设置要经过自己同意上车)

    滴嗒出行怎么设置导航(滴嗒出行怎么设置要经过自己同意上车)

  • 抖音合拍视频如何分开(抖音合拍视频如何发评论区)

    抖音合拍视频如何分开(抖音合拍视频如何发评论区)

  • 小米8se能插储存卡吗(小米8se能不能放内存卡)

    小米8se能插储存卡吗(小米8se能不能放内存卡)

  • 普通测厚仪怎么读数(测厚仪怎么样)

    普通测厚仪怎么读数(测厚仪怎么样)

  • 早教机如何连wifi(智能早教机怎么联网)

    早教机如何连wifi(智能早教机怎么联网)

  • 英语趣配音怎么下载视频(英语趣配音怎么多人合作)

    英语趣配音怎么下载视频(英语趣配音怎么多人合作)

  • 手机流量限速怎么解除(手机流量限速怎么弄)

    手机流量限速怎么解除(手机流量限速怎么弄)

  • 微信有计步功能吗(微信有计步功能吗怎么用)

    微信有计步功能吗(微信有计步功能吗怎么用)

  • 快手直播自定义封面(快手直播自定义音乐)

    快手直播自定义封面(快手直播自定义音乐)

  • ehrec.exe进程有何作用 ehrec是安全的进程吗(explorer进程作用)

    ehrec.exe进程有何作用 ehrec是安全的进程吗(explorer进程作用)

  • 二十场数学建模竞赛【详细思路+代码】总结(数学建模 比赛)

    二十场数学建模竞赛【详细思路+代码】总结(数学建模 比赛)

  • 百度文心一言对标 ChatGPT,你怎么看?(百度文心一言对未来商业的影响)

    百度文心一言对标 ChatGPT,你怎么看?(百度文心一言对未来商业的影响)

  • 实际上缴税费总额怎么算
  • 缴纳销项税额要交税吗
  • 产品入库实际成本是什么凭证
  • 汽车按揭费用收合法吗?
  • 用金税盘怎样认证抵扣
  • 冲减预付账款怎么记账
  • 发行收入要减去股本吗
  • 进项税额转出会影响利润吗
  • 所得税税负率是多少
  • 快递费开专票怎么入账
  • 增值税发票如何红冲
  • 投资收益税前扣除标准
  • 小规模免税增值税申报表怎么填
  • 信用减值损失借方余额在利润表中
  • 增值税小规模纳税人减免增值税政策
  • 因改制重组等原因撤回出口退税备案需要提交哪些资料?
  • 苹果mac切换桌面快捷键
  • 鸿蒙系统通知栏和控制
  • win10内存完整性不兼容的驱动程序
  • 总资产报酬率怎么查
  • php parse_url
  • linux中ls命令的意思
  • 公司取得发明专利证书股票大涨
  • 收到进项税发票如何入账
  • linux中的大于号什么意思
  • vrvarp.exe是什么
  • 取得抵债资产的方式
  • 本单位生产的水泥属于
  • yolov3网络结构详解
  • 收到小微企业贷款减息会计处理办法
  • php 表单
  • segment anything model github
  • php判断ua
  • 办公室清洁费计算公式
  • 研发样品收入的最新规定
  • 微众银行贷款利率2023最新
  • 矿产资源补偿费计入税金及附加吗
  • 个人所得税转账扣除子女教育那个什么时候可以提交
  • 帝国cms数据表
  • 可视化调参
  • 织梦标签理解
  • 房产税的计算器
  • 土地增值税预缴计税依据
  • 公司户和个人户交强险一样吗
  • 在建工程账务处理会计分录
  • 实际成本法如何核算
  • 加油卡充值可以开增值税专用发票吗
  • 会计中应收账款属于什么科目
  • 借方和贷方是什么意思 现金日记账
  • 存货取得长期股权投资
  • 调整以前年度多计提的增值税
  • 高新技术企业政府补助要交所得税吗
  • 安置用房视同销售,怎么确认扣除费用?
  • 公司买的车如何入账举例说明
  • 总公司与分公司账务处理
  • 生产成本的会计科目分录
  • 总资产报酬率的利息支出是财务费用吗
  • 技术咨询服务开票代码
  • 付款与开票单位不一致怎样做账
  • 总分机构和分总机构的区别
  • 公允价值举例说明
  • 限定性净资产举例
  • 商业企业的期间费用包括
  • 高端电脑品牌
  • centos 安装
  • win7系统摄像头图标不见了
  • windows u盘不识别
  • win10在哪里更改用户名
  • xp更改系统区域设置
  • linux硬盘io
  • 电脑系统脚本错误
  • nodejs 代码加密
  • meta 标签
  • nodejs怎么下载其他版本
  • shell脚本用法
  • jquery 动态绑定click事件
  • Python中的def
  • 税务局取消办税人员
  • 古代怎样征兵
  • 怎样查工商局备案
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设