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

  • vivox70pro支持多少倍变焦(vivox70pro支持2k吗)

    vivox70pro支持多少倍变焦(vivox70pro支持2k吗)

  • ipad 5g版能打电话吗(5g版ipad可以打电话吗)

    ipad 5g版能打电话吗(5g版ipad可以打电话吗)

  • 华为p40铃声渐强如何关闭(华为p40pro铃声渐变大)

    华为p40铃声渐强如何关闭(华为p40pro铃声渐变大)

  • p20是徕卡双摄像头吗(华为p20pro莱卡镜头怎么用)

    p20是徕卡双摄像头吗(华为p20pro莱卡镜头怎么用)

  • 为什么关注请求不见了(关注已请求)

    为什么关注请求不见了(关注已请求)

  • 微信对齐发出去不对齐(微信 对齐)

    微信对齐发出去不对齐(微信 对齐)

  • oppo查找手机显示离线什么意思(oppo查找手机显示所有设备均离线)

    oppo查找手机显示离线什么意思(oppo查找手机显示所有设备均离线)

  • 笔记本不能开机的几个情况(惠普笔记本不能开机)

    笔记本不能开机的几个情况(惠普笔记本不能开机)

  • 官方认证什么意思(官方认证是真的吗)

    官方认证什么意思(官方认证是真的吗)

  • 显卡待机50度正常吗(显卡待机五十度)

    显卡待机50度正常吗(显卡待机五十度)

  • ppt组合快捷键是什么(ppt里的组合快捷键)

    ppt组合快捷键是什么(ppt里的组合快捷键)

  • myaal10是什么手机(myaal10是华为什么型号手机)

    myaal10是什么手机(myaal10是华为什么型号手机)

  • 计算机按原理可分为(计算机按照计算机原理可分为)

    计算机按原理可分为(计算机按照计算机原理可分为)

  • office是一种什么软件(office是什么作用)

    office是一种什么软件(office是什么作用)

  • 头盔显示器主要组成是什么(头盔显示器的作用)

    头盔显示器主要组成是什么(头盔显示器的作用)

  • 华为mate30出厂有贴膜吗(华为mate30出厂有指纹解锁吗)

    华为mate30出厂有贴膜吗(华为mate30出厂有指纹解锁吗)

  • 一加dc调光有什么用(一加的dc调光真的有用吗)

    一加dc调光有什么用(一加的dc调光真的有用吗)

  • ios13深色模式有什么用(ios13深色模式有哪些应用支持)

    ios13深色模式有什么用(ios13深色模式有哪些应用支持)

  • 快手什么时候成立的(快手是什么时候开始)

    快手什么时候成立的(快手是什么时候开始)

  • 合同扫描件怎么弄一份(合同扫描件怎么发)

    合同扫描件怎么弄一份(合同扫描件怎么发)

  • 快手更新不了怎么回事(快手咋更新不了新版本)

    快手更新不了怎么回事(快手咋更新不了新版本)

  • iphone xs max如何开机(iphonexsmax如何强制重启手机)

    iphone xs max如何开机(iphonexsmax如何强制重启手机)

  • 4g没有网络怎么回事(4g没有网络怎么回事 电信手机)

    4g没有网络怎么回事(4g没有网络怎么回事 电信手机)

  • 华为p30pro屏闪怎么回事(华为p30 pro闪屏)

    华为p30pro屏闪怎么回事(华为p30 pro闪屏)

  • 黑鲨手机能插耳机吗(黑鲨手机插耳机不好用肩键)

    黑鲨手机能插耳机吗(黑鲨手机插耳机不好用肩键)

  • Vue3通透教程【十四】TS复杂类型详解(一)

    Vue3通透教程【十四】TS复杂类型详解(一)

  • 过路费是来回收费还是单向
  • 辞退员工补偿金账务处理
  • 存在弃置费用的固定资产有哪些
  • 补助属不属于工资
  • 厂房消防安装图
  • 以前年度损益调整属于哪类科目
  • 股票持有多久可以打新股
  • 纳税人在同一地级行政范围内跨县经营
  • 税务申报零申报怎么操作
  • 一般纳税人注销需要多少钱
  • 企业所得税税前不得扣除的项目
  • 房屋装修费用计算器
  • 年终奖怎么缴纳个税
  • 美国税改“梦想”很丰满,显示很骨感
  • 审计报告的二维码扫出来是什么
  • 资产评估溢价部分如何处理?
  • 城市维护建设税属于什么科目
  • 出口50万货物退多少税
  • 小企业出售无形资产发生的净损失应当计入什么科目
  • 小规模纳税人金融服务税率
  • windowsserver2003设置用户密码
  • 土地征收补偿款多久到账
  • 所得税年报期间费用明细表
  • 公司餐饮费怎么做账
  • 苹果桌面小工具怎么设置
  • 增值税税控系统折旧
  • 新准则管理费用税金
  • PHP:Memcached::getStats()的用法_Memcached类
  • php ftp上传文件
  • 如何把握售后租回交易的主要问题
  • 前端后端选择
  • 合同的第三方指什么
  • 税务机关代小规模纳税人开发票
  • 应收票据确认坏账怎么处理
  • phalcon model在插入或更新时会自动验证非空字段的解决办法
  • html编写
  • 微信小程序父子通信
  • 量子退火算法入门6
  • 微信小程序下拉菜单怎么做
  • chat top
  • 固定资产一次性扣除政策
  • python中self详解
  • mysql备份导入
  • dedecms模版
  • 预收账款挂多久确认收入
  • 预付开发票加油后还能开吗?
  • 企业所得税是指利润的税吗
  • 资产负债表第二年怎么填
  • 综合所得算税公式
  • 当月作废的发票是否需要报税
  • 无形资产出售时累计摊销为什么在借方
  • 工会会计有工资么
  • 增发股票会计科目
  • 会计忘记申报税款会有什么影响
  • 一般要做代理,授权书有什么用
  • 企业应如何正确经营
  • SQLServer EVENTDATA()函数来获取DDL 触发器信息
  • Win10应用商店下载错误
  • 如何保存xps文件
  • 苹果macOS 14 正式发布
  • linux系统tar命令
  • 一键u盘装系统软件哪个好
  • ubuntu系统查看mac地址命令
  • 乌班图系统切换root
  • 苹果电脑安装虚拟机会有什么影响
  • linux数据恢复公司 海南
  • win8.
  • 删除了c盘安全组或用户
  • js中的apply方法
  • 希尔排序数据结构的代码
  • javascript函数自调用
  • angularjs1.5
  • 关于numpy中loadtxt函数的说法
  • unity二段跳
  • javascript基础入门视频教程
  • 苏州税务ukey客服电话
  • 国地税机构改革方案
  • 福州房管局网签查询
  • 公司被税务查账对不上
  • 国税 地税比例
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设