brat安装使用记录

Brat标注工具(本地)安装及使用

一、安装

1.下载安装包

在官网下载安装包 http://brat.nlplab.org/index.html

2.解压

tar xzf 路径/文件名
eg: tar xzf Downloads/brat-v1.3_Crunchy_Frog.tar.gz

3. 进入文件夹

cd brat-v1.3_Crunchy_Frog/

4.安装

./install.sh
(sudo ./install.sh)
image.png

注册用户的名字和密码,邮箱

5.运行

python2 standalone.py

二、使用

1.登录后,选中文本后会弹出窗口,选择实体类型
2.拖动标注好的实体可以连接关系
3.双击标签可对标签进行修改或删除
4.点击data可导出标注好的数据
ps:未登录不能进行标注

配置文件

annotation.conf在这个配置文件中设置定义实体、关系、事件和属性

1.entities用来定义标注的实体名称,其格式为每行一个实体类型,
    比如:人名、地名、英雄名、技能名等,可以采用tab来增加二级标注,
    hero
        hero1
2.relations用来定义实体间的关系,格式为每行定义一种关系,第一列为关系类型,
    随后是用逗号分隔的ArgNrelations用来定义实体间的关系,格式为每行定义一种关系,第一列为关系类型,
    随后是用逗号分隔的ArgN:实体名,用来表示关系的各个相关者。
    relation1 Arg1:hero1, Arg2:hero1
3.events用来定义事件,每行定义一类事件,第一列为事件名,随后是用逗号分隔的Participant:实体名,
    用来表示事件的各个参与者。
4.attributes用来定义属性,每行一个属性,第一列为属性名,随后是用逗号分隔的Arg:<模块类型>, Value:属性值,
    注意属性值可以有多个


image.png

如果要使用中文信息,

visual.conf#视觉配置文件

1.采用中文标签时需要
2.将annotation.conf中名称替换


visual.conf内容
[labels]

# Label definitions for display. The labels are separated by pipe
# characters "|".

# The first label must correspond to the form found first in other
# configuration files. As this form must be valid for use in e.g. the
# BioNLP ST standoff format, it must have only ASCII alphanumerics,
# "_" or "-" (i.e. match '^[a-zA-Z0-9_-]$').

# Labels other than the first define forms that are presented to the
# user in the annotation interface, with the first form being the
# preferred full form and the others abbreviations that will be used
# if fuller forms do not fit in the given space. These have no format
# restrictions and can contain e.g. space (this tends to make the
# first and second columns identical for most terms, which do not
# contain space). Surrounding space is ignored.


### Entity types

Person | 人物
Organization | Organization | Org
GPE | Geo-political entity | GPE
company | 公司

image.png

中文支持

brat默认不支持中文,如果不配置会识别不出。

修改

n = re.sub(u'[^a-zA-Z\u4e00-\u9fa5<>,0-9_-]', '_', n)

到./server/src/projectconfig.py第163行

文本

不能直接使用txt,还需要给.txt文件添加.ann的标引文件

find 文件夹名称 -name '*.txt'|sed -e 's|\.txt|.ann|g'|xargs touch
eg:find data/exa -name '*.txt'|sed -e 's|\.txt|.ann|g'|xargs touch
eg:find data/exa -name 'test.txt'|sed -e 's|\.txt|.ann|g'|xargs touch

添加用户

直接在config.py文件中添加
USER_PASSWORD = { 
'admn': 'admin', 
'test': 'test', 
#'user':'password',
# (add USERNAME:PASSWORD pairs below this line.) 
}

不同用户

可能有文件权限的问题
chmod

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。