SiriBlog

siriyang的个人博客


  • 首页

  • 排行榜

  • 标签115

  • 分类37

  • 归档320

  • 关于

  • 搜索

BRAT安装与使用

发表于 2021-07-24 更新于 2021-10-29 分类于 计算机 , 环境 阅读次数: Valine:
本文字数: 3.8k 阅读时长 ≈ 3 分钟

BRAT安装与使用


使用环境:centos7

安装

官方文档:

Installation - brat rapid annotation tool

下载brat

brat rapid annotation tool

直接下载或手动上传到/export/softwares文件夹

1
2
3
mkdir -p /export/softwares
cd /export/softwares
wget http://weaver.nlplab.org/~brat/releases/brat-v1.3_Crunchy_Frog.tar.gz #wget直接下载

官网有点问题,下载的安装包损坏。建议直接通过其他镜像下载手动上传。

安装apache

使用独立运行模式则不用安装apache

https://blog.csdn.net/qq_15111861/article/details/83009341

https://www.cnblogs.com/yoke/p/7236293.html?utm_source=itdadao&utm_medium=referral

安装

1
yum install httpd

启动

1
systemctl start httpd

设置开机启动

1
systemctl enable httpd

安装brat

https://zhuanlan.zhihu.com/p/65101293

使用apache运行

解压

1
2
3
tar -zxvf /export/softwares/brat-v1.3_Crunchy_Frog.tar.gz -C /var/www/html/
cd /var/www/html/
mv brat-v1.3_Crunchy_Frog/ brat

第一次运行前先执行安装脚本

1
2
cd /var/www/html/brat/
./install.sh

输出

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Please the user name that you want to use when logging into brat
root
Please enter a brat password (this shows on screen)
123456
Please enter the administrator contact email
root@example.com
Assigning owner of the following directories to apache (apache):
"/var/www/html/brat/work/"
and
"/var/www/html/brat/data/"
(this requires sudo; please enter your password if prompted)
The installation has finished, you are almost done.

1.) If you are installing brat on a webserver, make sure you have
followed the steps described in the brat manual to enable CGI:

http://brat.nlplab.org/installation.html

2.) Please verify that brat is running by accessing your installation
using a web browser.

You can automatically diagnose some common installation issues using:

tools/troubleshooting.sh URL_TO_BRAT_INSTALLATION

If there are issues not detected by the above script, please contact the
brat developers and/or file a bug to the brat bug tracker:

https://github.com/nlplab/brat/issues

3.) Once brat is running, put your data in the data directory. Or use
the example data placed there by the installation:

/var/www/html/brat/data

4.) You can find configuration files to place in your data directory in
the configurations directory, see the manual for further details:

/var/www/html/brat/configurations

5.) Then, you (and your team?) are ready to start annotating!

访问:http://localhost/brat

独立运行

创建文件夹并解压安装包

1
2
3
mkdir -p /export/servers/
tar -zxvf /export/softwares/brat-v1.3_Crunchy_Frog.tar.gz -C /exprot/servers/
mv /exprot/servers/brat-v1.3_Crunchy_Frog/ /exprot/servers/brat/ #重命名文件夹

进入brat根目录,初次运行执行install.sh进行初始化配置

1
2
cd /exprot/servers/brat/
./install.sh

使用独立运行模式启动

python要使用2.7版本的

1
python standalone.py

在后台运行

1
2
3
[root@localhost brat-v1.3_Crunchy_Frog]# nohup python standalone.py &
[1] 4068
[root@localhost brat-v1.3_Crunchy_Frog]# nohup: ignoring input and appending output to ‘nohup.out’

此时会提示后台进程的进程号,以及输出信息都追加在nohup.out文件中

查询是否有该进程

1
2
3
[root@localhost brat-v1.3_Crunchy_Frog]# ps -aux | grep standalone
root 4068 0.5 0.7 219304 13520 pts/1 S 15:49 0:00 python standalone.py
root 4248 0.0 0.0 112808 968 pts/1 S+ 15:49 0:00 grep --color=auto standalone

终止进程

1
kill -9 4068

如果权限不够可能需要sudo

1
sudo kill -9 4068

访问:http://localhost:8001


配置

添加实体

修改brat/annotation.conf来添加自己的实体、关系、事件以及字段属性

1
vim /exprot/servers/brat/annotation.conf

具体格式参见配置文件中的注释

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[entities]

# Definition of entities.

# Format is a simple list with one type per line.

toushu_reson
month
money
phone_number
kuandai_number

[relations]

...

[events]

...

[attributes]

...

添加用户

1
2
3
4
5
6
7
8
$ cd /exprot/servers/brat/
$ vim config.py
USER_PASSWORD = {
'root': '123456',
'user1': '123456',
'user2': '123456',
# (add USERNAME:PASSWORD pairs below this line.)
}

使用

登陆

需要登陆以后才能打标,登陆前只能查看

打开浏览文件

快捷键TAB

导入、导出数据

注意,数据文件夹路径和文件名都不得带有中文字符!

手动操作

数据的导入导出可直接在命令行中对系统文件进行操作。

将源文件放在brat/data目录下。

导入源文件以后还要手动创建对应的空的.ann文件

如:

1
2
3
4
brat
|- data
|- test.txt
|- test.ann

批量导出

使用该方法会将data目录下的所有数据打包导出

添加标记

直接使用鼠标勾画要打标的文本片段

弹出窗口中选择对应的实体类型

确认保存

修改标记

双击标签

在弹出窗口中进行标签的更改、删除、移动

-------- 本文结束 感谢阅读 --------
相关文章
  • Docker:基于base_centos安装SuperSet
  • Docker:基于base_centos安装MySQL
  • Docker:基于CentOS8的基础镜像制作
  • Hexo:将博客部署到腾讯云服务器
  • Docker:手动下载安装Docker镜像
觉得文章写的不错的话,请我喝瓶怡宝吧!😀
SiriYang 微信支付

微信支付

SiriYang 支付宝

支付宝

  • 本文标题: BRAT安装与使用
  • 本文作者: SiriYang
  • 创建时间: 2021年07月24日 - 16时07分
  • 修改时间: 2021年10月29日 - 18时10分
  • 本文链接: https://blog.siriyang.cn/posts/20210724164401id.html
  • 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!
Linux 环境 CentOS
一个研究生的知识管理解决方案
美团面试题:小美的讨厌数字
  • 文章目录
  • 站点概览
SiriYang

SiriYang

努力搬砖攒钱买镜头的摄影迷
320 日志
33 分类
88 标签
RSS
GitHub E-Mail
Creative Commons
Links
  • 友情链接
  • 作品商铺

  1. BRAT安装与使用
    1. 安装
      1. 下载brat
      2. 安装apache
    2. 安装brat
      1. 使用apache运行
      2. 独立运行
    3. 配置
      1. 添加实体
      2. 添加用户
    4. 使用
      1. 登陆
      2. 打开浏览文件
      3. 导入、导出数据
      4. 添加标记
      5. 修改标记
蜀ICP备19008337号 © 2019 – 2025 SiriYang | 1.7m | 25:41
0%