不连续面向数据的解析
disco-dop的Python项目详细描述
这个项目的目的是分析自然界中不连续的成分 面向数据的解析语言(dop),关注全球 统治。语法是从注释过的句子的树库中提取出来的。 具有(不连续的)短语结构树。具体来说,这个项目提供了 支持不连续成分的统计选区分析器 以及面向数据的解析。不连续成分通过 语法形式主义线性上下文无关重写系统 概率上下文无关文法(pcfg)的推广。面向数据 解析允许重用以前看到的任意大小的片段 使用树替换语法(TSG)的句子。
本自述文件的内容:
Features
一般统计分析:
- 语法形式:pcfg,plcfrs
- 提取树库语法:树分解为结果,相对 频率作为概率
- 精确的k-最佳派生列表
- 粗到细修剪:后阈值, k-最好从粗到细
特定于DOP(使用树片段分析):
- 实施:古德曼的DOP减少,双DOP,DOP1。
- 估计量:相对频率估计(rfe)、等权估计(ewe)。
- 目标函数:最可能分析(MPP) 最可能推导(MPD)、最可能最短推导(MPSD) 最可能最短派生树(SL-DOP)。
- 边缘化:n-最佳导子,抽样导子。
Installation
要求:
- python3.3+http://www.python.org(需要标题,例如python3 dev包)
- cython 0.21+http://www.cython.org
- 纽比1.5+http://numpy.org/
支持Python2.7,但建议使用Python3。 运行python 2.7时安装futures包。
Debian, Ubuntu based systems
要在Ubuntu系统上编译最新的开发版本, 运行以下命令序列:
sudo apt-get install build-essential python3-dev python3-numpy python3-pip git git clone --depth 1 git://github.com/andreasvc/disco-dop.git cd disco-dop pip3 install --user -r requirements.txt make install
--user选项意味着软件包将安装到您的家中 不需要根权限的目录。确保 ~/.local/bin目录在您的路径中,或按如下方式添加:
echo export PATH=$HOME/.local/bin:$PATH >> ~/.bashrc
Other Linux systems
这假定没有根访问权限,但假定已安装gcc。
设置环境变量,以便软件可以安装到主目录 (如果不使用bash,则替换为与shell等效的内容):
mkdir -p ~/.local echo export PATH=$HOME/.local/bin:$PATH >> ~/.bashrc echo export LD_LIBRARY_PATH=$HOME/.local/lib:/usr/lib64:/usr/lib >> ~/.bashrc echo export PYTHONIOENCODING="utf-8" >> ~/.bashrc
在此之后,重新登录或重新启动shell以激活这些设置。 从源代码安装python 3(如果尚未安装)。 python可能需要一些库,比如zlib和readline; 安装步骤类似于以下步骤:
wget http://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz tar -xzf Python-*.tgz cd Python-* ./configure --prefix=$HOME/.local --enable-shared make install && cd ..
运行python3检查是否已成功安装3.5.1版,以及 是默认值。
安装最新开发版本的discodop:
wget https://github.com/andreasvc/disco-dop/archive/master.zip unzip disco-dop-master.zip cd disco-dop-master pip install --user -r requirements.txt make install
Other systems
如果不运行Linux,则可以在虚拟机中运行代码。 为此,请安装Virtualbox 下载预先安装了disco dop的虚拟机imagine: http://lang.science.uva.nl/VMs/discodop-vboximage.zip
Usage, documentation
DiscoDop可通过三种方式使用:
- 通过命令行;cf discodop命令的手册页 作为安装的一部分安装:man discodop。
- 作为图书馆,请参阅API reference 以及example notebooks
- Web interfaces
注意:避免从源树中运行discodop,以确保戴帽子 将导入已安装的模块版本。
Grammars
cf.https://lang.science.uva.nl/grammars/
英语、德语和荷兰语语法描述如下 van Cranenburgh et al., (2016); 法语语法出现在Sangati & van Cranenburgh (2015)。 相比之下,还有一种英语语法没有间断性 成分(ptb-nodisc)。
Acknowledgments
tree.py中的树数据结构和简单的二值化算法 在^{tt12}中,$从NLTK中取出。 treedist.py中的zhang shasha树编辑距离算法来自 https://github.com/timtadh/zhang-shasha plcfrs解析器的元素和标点符号的重新附加基于代码 来自rparse。其他的灵感来源 由Stanford Parser、Berkeley Parser、Bubs Parser和C提供。
References
如果您在 出版物:
@article{vancranenburgh2016disc, title={Data-Oriented Parsing with discontinuous constituents and function tags}, author={van Cranenburgh, Andreas and Remko Scha and Rens Bod}, journal={Journal of Language Modelling}, year={2016}, volume={4}, number={1}, pages={57--111}, url={http://dx.doi.org/10.15398/jlm.v4i1.100} }