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

  • 苏康码用支付宝如何解绑(苏康码用支付宝怎么解绑)

    苏康码用支付宝如何解绑(苏康码用支付宝怎么解绑)

  • 苹果12不送充电器吗(苹果12不送充电线吗)

    苹果12不送充电器吗(苹果12不送充电线吗)

  • ipad7,11是什么意思(ipad7,11是什么型号)

    ipad7,11是什么意思(ipad7,11是什么型号)

  • qq气泡免费的名字(qq里免费气泡名字)

    qq气泡免费的名字(qq里免费气泡名字)

  • 拼多多保证金是每个月都要交吗(拼多多保证金是原路回微信吗)

    拼多多保证金是每个月都要交吗(拼多多保证金是原路回微信吗)

  • 红包超过24小时未领取,对方能看到金额吗(红包超过24小时未领,是退回吗)

    红包超过24小时未领取,对方能看到金额吗(红包超过24小时未领,是退回吗)

  • vga灯亮无法开机(vga灯亮无法开机还漏电)

    vga灯亮无法开机(vga灯亮无法开机还漏电)

  • ic是什么电子器件(电子元器件ic是干什么的)

    ic是什么电子器件(电子元器件ic是干什么的)

  • oppor9splus手机一直重启循环怎么回事(oppor9splus手机一直重启循环开不了机修好还能用多久)

    oppor9splus手机一直重启循环怎么回事(oppor9splus手机一直重启循环开不了机修好还能用多久)

  • 华为手机移动数据打不开怎么回事(华为手机移动数据图标在哪里设置)

    华为手机移动数据打不开怎么回事(华为手机移动数据图标在哪里设置)

  • 备份与恢复是什么意思(备份和恢复)

    备份与恢复是什么意思(备份和恢复)

  • 苹果6跟苹果8的尺寸是一样的吗(苹果6跟苹果8的屏幕通用吗)

    苹果6跟苹果8的尺寸是一样的吗(苹果6跟苹果8的屏幕通用吗)

  • 电脑fast boot什么意思(电脑fast boot怎么设置)

    电脑fast boot什么意思(电脑fast boot怎么设置)

  • hit电池什么意思(hit电池最新消息)

    hit电池什么意思(hit电池最新消息)

  • 苹果8p左上角阴影什么原因(苹果8p左上角阴影扩散么)

    苹果8p左上角阴影什么原因(苹果8p左上角阴影扩散么)

  • 微信绑定手机号操作过于频繁(微信绑定手机号注销了微信还能用吗)

    微信绑定手机号操作过于频繁(微信绑定手机号注销了微信还能用吗)

  • 怎么在天猫上开网店(怎样开天猫)

    怎么在天猫上开网店(怎样开天猫)

  • 华为手表gt2支持苹果吗(华为手表Gt2支持Magic OS吗)

    华为手表gt2支持苹果吗(华为手表Gt2支持Magic OS吗)

  • 拼多多怎么取消推荐(拼多多怎么取消隐私号码取件)

    拼多多怎么取消推荐(拼多多怎么取消隐私号码取件)

  • 怎么无线充电(手机在车上怎么无线充电)

    怎么无线充电(手机在车上怎么无线充电)

  • 学信网账号注销的后果(学信网账号注销后学籍还在吗)

    学信网账号注销的后果(学信网账号注销后学籍还在吗)

  • 电话号码停机多久销号(电话号码停机多久不能用)

    电话号码停机多久销号(电话号码停机多久不能用)

  • qq聊天界面上的耳朵是什么(qq聊天界面的空间动态如何去除)

    qq聊天界面上的耳朵是什么(qq聊天界面的空间动态如何去除)

  • vivox27如何设置人脸识别(vivox27如何设置动态壁纸)

    vivox27如何设置人脸识别(vivox27如何设置动态壁纸)

  • 抖音是一个什么软件(抖音是一个什么样的平台)

    抖音是一个什么软件(抖音是一个什么样的平台)

  • k3像素多少(oppok3像素多少)

    k3像素多少(oppok3像素多少)

  • 苹果xs max港版和国行的区别(iponexsmax港版和国行区别)

    苹果xs max港版和国行的区别(iponexsmax港版和国行区别)

  • Nginx静态资源部署(nginx搭建静态资源服务器)

    Nginx静态资源部署(nginx搭建静态资源服务器)

  • 公司卖出货物没有入库记录如何做账?
  • 内部伙食费购买会计分录
  • 小规模纳税人开票税率
  • 代扣代缴增值税怎么做账
  • 行政事业单位会计制度
  • 单位发放中秋月饼价值有规定吗
  • 个体户雇佣临时工
  • 转登记小规模纳税人留抵税额
  • 增值税进项税金额是含税还是不含税
  • 固定资产累计折旧完了怎么办
  • 营改增之后账务怎么处理
  • 企业所得税报表模板
  • 税控盘开票流程图解2022
  • 物业管理公司销售岗位职责
  • 房地产开发企业资质等级有几个
  • 第三方支付模式的交流流程
  • 税控盘超期还能清卡吗
  • 土地使用权出让金
  • 房地产开发企业预收款预缴增值税
  • 计提福利费用会计分录
  • 在win7系统中将打开窗口拖到屏幕顶端
  • 用人单位逾期未缴纳社会保险费可能会使用的文书
  • 外购商品可以直接结转成本吗
  • 销售部门品种多怎么说
  • 工会会员会费缴费证明怎么开
  • php生成php文件
  • 稿酬所得怎么交所得税
  • web漏洞扫描器的设计与实现
  • php 解压
  • 成本类账户期末余额在借方还是贷方
  • ctrl ate del
  • 免收印花税
  • vue导航方式
  • db management
  • 美团平台技术部是干什么的
  • 瓶盖再来一次表情包
  • 技术人员的工资计入什么费用
  • 个人发票需要什么抬头
  • 产品成本包括哪些
  • 哪些进项税额不能抵扣
  • 小规模房地产企业税收优惠政策
  • 按信用风险特征组合
  • 所得税审核一般需要多久
  • 免增值税进项税怎么弄
  • 疫情期间购买消毒弥雾机的请示
  • 单位食堂收费制度
  • 实收资本的账务处理会影响什么
  • 现金收账凭证
  • 账面价值大于计税基础是调增还是调减
  • 个人无偿赠与不动产税收管理
  • 企业如何建账做账
  • sql 查询优化
  • win7一键升级到win10
  • openbsd4.1+apache+mysql+php 环境配置
  • windows打不开添加打印机
  • windows取消定时任务
  • win10系统无法卸载补丁
  • win7系统点击桌面图标闪退
  • win7提示0x000000c1
  • linux批量ping
  • win8系统开机怎么进入桌面
  • jQuery实现ctrl+enter(回车)提交表单
  • css中div怎么用
  • perl \w
  • opengl教程48讲
  • unity导出3d模型
  • angular中ui calendar的一些使用心得(推荐)
  • 原生js实现promise.all
  • python怎么用
  • javascript面向对象编程指南第三版
  • 征管法第六十三条的内容
  • 外经证办理流程在哪个网站申请
  • 广东省电子税务局电话
  • 划拨土地是否可以出租的法律规定
  • 鸦片战争签订了条约
  • 在本地买车怎么上外地牌照
  • 江苏电子票据
  • 如何查到银行
  • 印花税属于什么业务类型
  • 大连开发区哪家自助餐好吃还便宜
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设