保姆级brat标注工具部署

保姆级brat标注工具部署,在弄崩了好几个虚拟机之后终于弄好了,毕竟菜鸡。。。

1.下载brat

进入brat官网下载安装包brat-v1.3_Crunchy_Frog.tar.gz

/home/你的用户名目录下新建文件夹命名为public_html,并将brat安装包解压缩到该文件夹。

进入brat-v1.3_Crunchy_Frog文件夹开始安装

bash install.sh

之后输入账号密码及邮箱

进入brat-v1.3_Crunchy_Frog/server/lib文件夹,解压缩flup-1.0.2.tar.gz

2.安装python2

brat运行需要python2,如果已安装则忽略

sudo apt install python

这里可能会提示以下错误

The following packages have unmet dependencies:
 python : PreDepends: python-minimal (= 2.7.15~rc1-1) but it is not going to be installed
          Depends: python2.7 (>= 2.7.15~rc1-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

输入以下命令解决,之后重新执行安装python的命令即可

sudo apt purge libpython2*
sudo apt install python

3.安装Apache并配置

sudo apt-get install apache2

配置Apache的配置文件

sudo vim /etc/apache2/apache2.conf

Ubuntu18.04默认安装vi,可以把上面命令的vim改成vi,如果想使用vim,执行以下命令删除vi安装vim

sudo apt-get purge vim-common
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install vim

进入apache2.conf文件后,将以下内容填入并保存

<Directory /home/你的用户名/public_html>
    AllowOverride Options Indexes FileInfo Limit
    AddType application/xhtml+xml .xhtml
    AddType font/ttf .ttf
    # For CGI support
    AddHandler cgi-script .cgi
    # Comment out the line above and uncomment the line below for FastCGI
    #AddHandler fastcgi-script fcgi
</Directory>

# For FastCGI, Single user installs should be fine with anything over 8
#FastCgiConfig -maxProcesses 16

suerdir赋权

sudo a2enmod userdir

输出提示信息如下:

Enabling module userdir.
To activate the new configuration, you need to run:
  systemctl restart apache2

安装libapache2-mod-fastcgi

sudo apt-get install libapache2-mod-fastcgi

这一步可能会提示:

正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
没有可用的软件包 libapache2-mod-fastcgi,但是它被其它的软件包引用了。
这可能意味着这个缺失的软件包可能已被废弃,
或者只能在其他发布源中找到

E: 软件包 libapache2-mod-fastcgi 没有可安装候选

解决办法:

打开sources.list

sudo vim /etc/apt/sources.list

在文件末添加

deb http://mirrors.digitalocean.com/ubuntu trusty main multiverse

deb http://mirrors.digitalocean.com/ubuntu  trusty-updates main multiverse

deb http://security.ubuntu.com/ubuntu  trusty-security main multiverse

保存后执行

sudo apt-get update

再次执行安装命令即可安装

继续输入以下命令

sudo a2enmod fastcgi
sudo a2enmod rewrite

输出提示信息如下:

Module fastcgi already enabled
Enabling module rewrite.
To activate the new configuration, you need to run:
  systemctl restart apache2

重新加载apache的配置:

sudo /etc/init.d/apache2 reload

进入到/home/你的用户名/public_html/brat-v1.3_Crunchy_Frog文件夹,然后执行:

sudo chgrp -R www-data data work
chmod -R g+rwx data work

安装standalone server

bash install.sh -u

然后运行服务

python standalone.py

之后便可以从你的ip地址+8001端口访问brat

4.使用

中文支持,在brat-v1.3_Crunchy_Frog/server/src目录下找到projectconfig.py文件,在162行可以看到

n  = re.sub(r'[^a-zA-Z0-9_-]', '_', n)

将其注释掉,并添加

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

添加标注文本,在brat-v1.3_Crunchy_Frog/data文件夹下添加标注的文本,然后在brat-v1.3_Crunchy_Frog目录下执行以下命令就会生成和标注文本文件名相同文件后缀为.ann的文件,这个文件保存了标注结果。

find data -name '*.txt' | sed -e 's|\.txt|.ann|g' | xargs touch

brat支持标注[entities][relations][events][attributes],把brat-v1.3_Crunchy_Frog目录下annotation.conf中对应的地方改成你要标注的即可,如果想要在标注页面显示成中文,则需要修改相同目录下的visual.conf,具体如何修改打开文件就明白了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值