MSTParser句法工具使用方法

55、探索泰卢固语解析与阿拉伯语语义标注的方法与实践 本文探讨了泰卢固语依赖解析的多种方法,包括结合MaltParser与MSTParser、投票法和融合法,并分析了各方法在UAS、LAS等指标上的表现,发现MaltParser在短距离依赖上优势明显。同时,文章研究了阿拉伯语语义标注的技术与挑战,介绍了基于本体和RDF的标注流程及其在提升信息检索性能方面的潜力。通过对比两种语言处理任务的方法与效果,总结了当前技术的优缺点,并展望了未来在训练数据扩展、黏着语处理及多语言融合方向的研究前景。 阅读详情

最近做实验用到依存句法分析。找依存工具找的头都大的。

standford parser的依存分析感觉有点不好,有的结点的父节点不止一个。貌似和严格的依存分析定义有冲突。所以没有用standford的工具。

minipar 依存分析,感觉很好用的工具,但是工具没有及时更新,他的demo中的makefile文件都弄不好。网上解决方法也找不到多少。没有办法,只好放弃。

最后,找到MSTParser这个工具。不得不说,这玩意在百度结果中还真少。

MSTParser是一个开源的句法分析工具,java写的。可以在linux window下运行。

工具下载地址: http://sourceforge.net/projects/mstparser/

工具说明:http://www.seas.upenn.edu/~strctlrn/MSTParser/README


先看看工具的说明目录:

----------------
Contents
----------------

1. Compiling

2. Example of usage

3. Running the parser
   a. Input data format
   b. Training a parser
   c. Running a trained model on new data
   d. Evaluating output

4. Memory/Disk space and performance issues

5. Reproducing results in HLT-EMNLP and ACL papers

1,编译

2,用法示例

3,运行分析器

     a.输入数据格式

     b.训练分析器

     c.使用训练模型分析新数据

     d.结果测评

4,内存/磁盘空间和性能问题

5,关于其的论文


现在可以在说明下编译文件了。

----------------
1. Compiling
----------------

To compile the code, first unzip/tar the downloaded file:

> gunzip mstparser.tar.gz
> tar -xvf mstparser.tar
> cd MSTParser

Next, run the following command

> javac -classpath ".:lib/trove.jar" mstparser/DependencyParser.java

This will compile the package.

注意:

在windows下面的命令应该是:

".;lib/trove.jar" mstparser/DependencyParser.java
原命令中间的冒号在windows下改为分号。(没编译好查看下自己的java的版本 说明文件说工具在java1.4 1.5下使用)


ok,现在mstparser文件夹下面的.java文件都应该被编译,生成了.class文件。

继续 


说明文档给出 使用示例 

2. Example Usage
---------------------

In the directory data/ there are examples of training and testing data. Data
format is described in the next section.

train.ulab/test.ulab
- training and testing data with unlabeled trees

train.lab/test.lab
- training and testing data with labeled trees

To run an unlabeled parser type:

> java -classpath ".:lib/trove.jar" -Xmx1800m mstparser.DependencyParser \
  train train-file:data/train.ulab model-name:dep.model \
  test test-file:data/test.ulab output-file:out.txt \
  eval gold-file:data/test.ulab
  
This will train a parser on the training data, run it on the testing data and
evaluate the output against the gold standard. The results from running the
parser are in the file out.txt and the trained model in dep.model.

To train an labeled parser run the same command but use the labeled training
and testing files.

主要关注命令:

> java -classpath ".:lib/trove.jar" -Xmx1800m mstparser.DependencyParser \
  train train-file:data/train.ulab model-name:dep.model \
  test test-file:data/test.ulab output-file:out.txt \
  eval gold-file:data/test.ulab

这里面

 train train-file:data/train.ulab model-name:dep.model \

训练使用的文件  data文件夹下面的 train.ulab  训练出来的模型放在 dep.model中

test test-file:data/test.ulab output-file:out.txt \
测试使用的文件 data文件夹下面的test.ulab( ***注意 训练文件的格式需要注意 后面会提及的)   得到的输出放在 out.txt文件中

  eval gold-file:data/test.ulab
评测的答案 data文件夹下面的test.ulab(就是刚才的测试的文件)


上述命令使用的是ulab文件(应该翻译为 未标注的文件),同时命令可以使用在data文件夹下面的lab文件(标注文件)上。

(*************标注文件和未标注文件 后面文件格式中会说明)


继续

-------------------------
3. Running the Parser
-------------------------
开始要使用工具了。

-------------------------
3a. Input data format
-------------------------

Example data sets are given in the data/ directory.

Each sentence in the data is represented by 3 or 4 lines and sentences are
space separated. The general format is:

w1    w2    ...    wn
p1    p2    ...    pn
l1    l2    ...    ln
d1    d2    ...    d2

....


Where,
- w1 ... wn are the n words of the sentence (tab deliminated)
- p1 ... pn are the POS tags for each word
- l1 ... ln are the labels of the incoming edge to each word
- d1 ... dn are integers representing the postition of each words parent

For example, the sentence "John hit the ball" would be:

John	hit	the	ball
N	V	D	N
SBJ	ROOT	MOD	OBJ
2	0	4	2

Note that hit's parent is indexed by 0 since it is the root.

If you wish to only train or test an unlabeled parser, then simply leave out
the third line for each sentence, e.g.,

John	hit	the	ball
N	V	D	N
2	0	4	2

The parser will automatically detect that it should produce unlabeled trees.

Note that this format is the same for training AND for running the parser on
new data. Of course, you may not always know the gold standard. In this case,
just substitute lines 3 (the edge labels) and lines 4 (the parent indexes) with
dummy values. The parser just ignores these values and produces its own.

上面就是写的数据输入格式

John	hit	the	ball
N	V	D	N
SBJ	ROOT	MOD	OBJ
2	0	4	2
第一行是 每个单词

第二行是 每个词的 词性

第三行是 依存弧上的属性关系

第四行是 父节点的位置(0表示其为根节点  ,John下的2 表示John节点的父亲是2号位置的hit)

上面是lab文件的格式,如果不要第三性的信息就成为ulab文件的格式。

注意: 这里训练和测试文件都需要这样的格式。这里很奇怪,其他的分析器都只需要输入句子(即第一行的信息就行),这里还需要很多其他信息。

如果目的就是做依存分析,后面介绍。训练文件选择train.lab文件的话(训练和测试文件的格式需要一致,要么是四行的格式 lab文件格式,要么都是三行的格式 ulab格式),输入的test文件 格式如下:

John	hit	the	ball
N	V	D	N
LAB	LAB	LAB	LAB
0	0	0	0
第三行第四行分别是LAB 0 

*******注意  中间的分隔符是 "\t" 不是空格。空格会报错。(如果疑问可以查看源文件 DependencyParser.java)

----------------------------
3b. Training the parser
----------------------------

If you have a set of labeled data, first place it in the format described
above.

If your training data is in a file train.txt, you can then run the command:

> java -classpath ".:lib/trove.jar" -Xmx1800m mstparser.DependencyParser \
  train train-file:train.txt

This will train a parser with all the default properties. Additonal
properties can be described with the following flags:

train
- if present then parser will train a new model

train-file:file.txt
- use data in file.txt to train the parser

model-name:model.name
- store trained model in file called model.name

training-iterations:numIters
- Run training algorithm for numIters epochs, default is 10

decode-type:type
- type is either "proj" or "non-proj", e.g. decode-type:proj
- Default is "proj"
- "proj" use the projective parsing algorithm during training
  - i.e. The Eisner algorithm
- "non-proj" use the non-projective parsing algorithm during training
  - i.e. The Chu-Liu-Edmonds algorithm

training-k:K
- Specifies the k-best parse set size to create constraints during training
- Default is 1
- For non-projective parsing algorithm, k-best decoding is approximate

loss-type:type
- type is either "punc" or "nopunc", e.g. loss-type:punc
- Default is "punc"
- "punc" include punctuation in hamming loss calculation
- "nopunc" do not include punctuation in hamming loss calculation

create-forest:cf
- cf is either "true" or "false"
- Default is "true"
- If create-forest is false, it will not create the training parse forest (see
  section 4). It assumes it has been created.
- This flag is useful if you are training many models on the same data and
  features but using different parameters (e.g. training iters, decoding type).

order:ord
- ord is either 1 or 2
- Default is 1
- Specifies the order/scope of features. 1 only has features over single edges
  and 2 has features over pairs of adjacent edges in the tree.


------------------------------------------------
3c. Running a trained model on new data
------------------------------------------------

This section assumes you have trained a model and it is stored in dep.model.

First, format your data properly (section 3a).

It should be noted that the parser assumes both words and POS tags. To
generate POS tags for your data I suggest using the Ratniparkhi POS tagger
or another tagger of your choice.

The parser also assumes that the edge label and parent index lines are
in the input. However, these can just be artificially inserted (e.g. with lines
of "LAB ... LAB" and "0 ... 0") since the parser will produce these lines
as output.

If the data is in a file called test.txt, run the command:

> java -classpath ".:lib/trove.jar" -Xmx1800m mstparser.DependencyParser \
  test model-name:dep.model test-file:test.txt output-file:out.txt

This will create an output file "out.txt" with the predictions of the parser.
Other properties can be defined with the following flags:

test
- If included a trained parser will be run on the testing data

test-file:file.txt
- The file containing the data to run the parser on

model-name:model.name
- The name of the stored model to be used

output-file:out.txt
- The result of running the parser on the new data

decode-type:type
- See section 3b.

order:ord
- See section 3b. THIS NEEDS TO HAVE THE SAME VALUE OF THE TRAINED MODEL!!

Note that if you train a labeled model, you should only run it expecting
labeled output (e.g. the test data should have 4 lines per sentence).
And if you train an unlabeled model, you should only run it expecting
unlabeled output (e.g. the test data should have 3 lines per sentence).


------------------------
3d. Evaluating Output
------------------------

This section describes a simple class for evaluating the output of
the parser against a gold standard.

Assume you have a gold standard, say test.txt and the output of the parser
say out.txt, then run the following command:

> java -classpath ".:lib/trove.jar" -Xmx1800m mstparser.DependencyParser \
  eval gold-file:test.txt output-file:out.txt

This will return both labeled and unlabeled accuracy (if the data sets contain
labeled trees) as well as complete sentence accuracy, again labeled and
unlabeled.

We should note that currently this evaluation script includes all punctuation.
In future releases we will modify this class to allow for the evaluation to
ingnore punctuation, which is standard for English (Yamada and Matsumoto 03).

这边都是分开的命令了。分别是 训练模型 使用模型跑数据 测试结果。命令比较简单。不费口舌的。


以上就是这次实验用到的MSTParser工具。

注意事项就是:1,windows下的命令需要变一下

                       2,训练的数据需要自己标注词性并组织格式

                       3,没有答案的情况下需要写入LAB 0 并且所有的分隔符都是"\t"


--------------------------


over


 

54、自动化金融交易系统与泰卢固语解析方法探索 本文探讨了自动化金融交易系统(AFTS)与泰卢固语自然语言解析方法的研究。AFTS利用Python和NLTK实现从自然语言交易描述到会计分录的自动转换,支持日记账和分类账的生成,尽管在输入格式、语句复杂度和交易类型上存在局限。另一方面,针对泰卢固语的解析研究比较了MaltParser、MSTParser和TurboParser三种依赖解析器,在不同特征设置下取得了较高的准确率,并分析了其在主要语法关系和距离范围上的表现。研究为金融自动化和印度语言NLP应用提供了重要参考,未来可进一步优化系统鲁棒性与解析能力 阅读详情

相关推荐

基于最大生成树的依存句法分析工具MSTParser实战详解

图是描述对象间关系的数学结构,在形式上定义为 $ G = (V, E) $,其中 $ V $ 是顶点集合,$ E \subseteq V \times V $ 是边的集合。对于依存句法分析任务,句子中的每一个词项(token)对应图中的一个顶点,因此若句子长度为 $ n $,则 $ |V| = n $。在标准MSTParser建模中,初始图是一个完全图,即任意两个不同词之间都存在一条双向边(尽管后续会引入方向性)。

weixin_34885746的博客 1323

MSTParser工具使用

前言 最近做实验用到一个句法分析工具 MSTParser,关于句法分析的工具,目前使用比较多的是 Stanford 的工具,资料也容易找,但是这个MSTParser,资料是真的难找啊。我的任务是用这个工具测试对一些藏语数据建立句法树,由于资料比较少,所以也只是参考了官网README文件和一些远古时期的博客,在这里记录一下使用的过程(Windows环境下),方便日后查阅。 1.安装 1.1 官网 &...

MirrorN的博客 544

MSTGen_Tool_Guide

MSTAR方案LOGO制作工具MSTGen_Tool_Guide的详细指导书!

MSTParser的使用---

---恢复内容开始--- https://blog.youkuaiyun.com/neutblue/article/details/7375085 https://wenku.baidu.com/view/376c9d6c2af90242a895e5a1.html https://blog.youkuaiyun.com/qiqiaiairen/article/details/52599315 ---恢复内容结束-...

weixin_33995481的博客 152

MSTAR软件工具的使用方法

FTC驱动(MSTAR)driver,mstar烧录,MSTV_tool,单片机Mstar使用必备驱动下载,资源很少,附带Mstar ISp工具使用的。

Mstar软件工具的使用方法

Mstar软件工具的使用,包含ISP tool和Mstv tool,图文解释。

斯坦福NLP名课带学详解 | CS224n 第5讲 - 句法分析与依存解析(NLP通关指南·完结)

NLP课程第5讲内容覆盖:句法结构(成分与依赖),依赖语法与树库,基于转换的依存分析模型,神经网络依存分析器等。

ShowMeAI研究中心 5298

MSTParser.tar.gz_MSTParser_max-mstparser_依存句法_依存句法分析

MSTParser是以最大生成树理论为基础的判别式依存句法分析器。它将一科依存树的得分看作是 所有依存关系的得分的总和,从而依存分析的问题转化成如何寻找最高得分的依存树。

句法分析基础:依存句法与成分句法的形式化表示与解析算法

句法分析作为自然语言处理的核心基础任务之一,旨在揭示句子内部词语之间的结构化语法关系。本文系统性地阐述了句法分析领域的两大主流范式:依存句法分析与成分句法分析。文章首先从形式化表示入手,详细定义了依存图、依存树及其投射性约束,以及上下文无关文法与句法树的数学表达。在解析算法部分,深入剖析了基于转换的Arc-Eager依存解析策略、基于图的MST解码原理,以及成分句法中的CKY动态规划算法与概率上下文无关文法。最后,本文探讨了句法分析的评估指标体系,并对深度学习时代句法分析的发展趋势进行了前瞻性讨论。本文力求

AladdinEdu,你的AI学习实践工作坊。让想法落地,让研究加速。助力高校AI人才成长,点亮创新未来。 530

MSTParser:MSTParser是一个非投影依赖性解析器,用于搜索maxi-开源

MSTParser是一个非投影依赖性分析器,它在有向图上搜索最大生成树。 依存关系结构模型基于大幅度的判别训练方法。 还支持投影解析。 现在可以通过Maven Central获得mstparser 0.5.1。 如果使用Maven作为构建工具,则可以将其作为依赖项添加到pom.xml文件中: net.sourceforge.mstparser mstparser 0.5.1

开发基于GDL235KBQ6开发板的IAP升级程序(HEX协议+串口空闲中断 + DMA接收数据)

使用GDL235kB开发板,实现串口iap升级程序的bootloader代码编写,app为led灯闪烁,并完成通信c代码

zhaozijuncc的博客 648

Berkeley Document Summarizer核心原理:句法分析与RST修辞结构的完美结合

Berkeley Document Summarizer是一款基于学习的单文档摘要系统,它通过提取源文档内容、利用句法信息进行压缩,并使用共指约束确保摘要清晰度。该系统创新性地融合了句法分析与RST修辞结构理论,为文本摘要任务提供了强大的技术支撑。 ## 系统架构概览:从文本到摘要的完整流程 Berkeley Document Summarizer的核心处理流程包含三个关键阶段:文本预处理、深

gitblog_00434的博客 1087

脑机接口最新发展动态报告 (2024-2025)

脑机接口动态

高山 4112

NLP开源软件

来自http://www.xuebuyuan.com/1321828.html NLP开源软件 一、分词 1、  ICTCLAS http://www.ictclas.org/包含分词、词性标注功能, C++编写,提供Java借口,业界比较出名。 2、  Ansj中文分词 http://www.ansj.org/    分词 词性等  Jav

vincent2610的专栏 1338

深入分析大众点评 Ajax 接口:直接请求 JSON 数据高效获取评论

大众点评网站采用前后端分离架构,通过Ajax接口动态加载数据。按F12打开开发者工具,切换到Network(网络)面板。实际环境中,我们需要使用Python重现这一加密逻辑。查看请求响应,寻找包含评论数据的JSON接口。参数是大众点评的反爬机制核心,需要特别处理。:尊重网站的robots.txt文件规定。:仅将数据用于合法合规的研究和分析目的。:不侵犯大众点评的商业秘密和知识产权。打开大众点评网站,进入任意商户页面。:对采集到的用户信息进行脱敏处理。:避免对目标网站造成过大负担。

Z_suger7的博客 1591

Robocup 仿真2D 学习笔记(二) 球队代码编译和上场

环境的一些问题 最近在使用rcssserver 和 rcssmonitor时可能会遇到./configure失败的问题,可以检查一下文件夹是否有makefile文件,如果是编译后的包直接sudo make install,如果还不行,还可以源码下载编译 rcssserver: https://sourceforge.net/projects/sserver/files/rcssserver/...

markchalse的博客 6016

越南语 NLP 任务全景指南:NLP-progress 仓库中的数据集、评测基准与 SOTA 模型

本文以 NLP-progress 仓库中的 [vietnamese/vietnamese.md](https://link.gitcode.com/i/4f9eecd4781969d997d6017618736e1c) 为线索,系统梳理越南语自然语言处理在依赖句法分析、意图识别与槽位填充、机器翻译、命名实体识别、词性标注、语义解析与分词七大类任务上的公开评测数据集、评测口径与当前最优(SOTA)模

gitblog_00566的博客 423

Python实战:5分钟搞定滑动平均窗口计算(附完整代码+逐行注释)

本文深入解析Python中滑动平均窗口计算的实现与优化,提供Numpy、Pandas等多种高效方案,并附完整代码和逐行注释。涵盖边界处理、性能优化及异常检测等实战技巧,帮助开发者快速掌握时间序列数据处理的核心技术。

weixin_30872157的博客 127

Parser总结

stanford parser 地址:http://nlp.stanford.edu/software/lex-parser.shtml Mstparser  地址:http://www.seas.upenn.edu/~strctlrn/MSTParser/MSTParser.html

zlging309的专栏 484

百度慧眼人口位置数据:从原理到实战的GIS处理全流程

本文详细解析百度慧眼人口位置数据的处理全流程,从基本原理到实战应用。通过空间网格划分、终端数量统计等技术手段,百度慧眼数据能准确反映人群分布特征。文章涵盖坐标系转换、核密度分析、热力图制作等GIS处理技巧,并分享商业选址、城市规划等典型业务场景的解决方案,帮助读者高效利用这一数据资源。

weixin_30872157的博客 534

磁悬浮分子泵:起源、现状与未来趋势深度解析

摘要 磁悬浮分子泵作为高真空获取的关键设备,通过磁悬浮技术实现转子无接触高速运转,大幅提升了真空系统的性能和可靠性。本文系统梳理了分子泵从机械轴承到磁悬浮的技术演变历程,分析了当前行业格局及主要厂商产品特性,包括爱德华兹、普发真空等国际巨头的技术优势。研究进一步探讨了磁悬浮分子泵在半导体制造、科研设备等领域的核心应用,通过数学模型揭示了其性能参数关系。最后,展望了未来在智能化、节能化等方面的发展趋势,为相关领域的技术创新提供参考。 关键词:磁悬浮分子泵;高真空技术;半导体制造;科研设备;技术发展

技术工作者 691

Debootstrap实战:在Docker容器里‘种’出一个纯净的Debian/Ubuntu基础镜像

本文详细介绍了如何使用Debootstrap工具在Docker容器中构建精简、可审计的Debian/Ubuntu基础镜像。通过跨架构构建准备、多阶段构建方案和镜像优化技巧,开发者可以创建体积更小、依赖更少且安全可控的基础环境,特别适合金融级应用和嵌入式容器化场景。

weixin_33695450的博客 298

智能汽车嘚啵嘚 --- 智能座舱第七稿:智能座舱的升级OTA

智能汽车嘚啵嘚 --- 智能座舱第七稿:智能座舱的升级OTA

Soly_kun的博客 414
上一篇: 双语对齐工具Champollion tool kit的配置和使用
下一篇: python读写文件基本操作
warrioR_wx
博客等级 码龄16年 388粉丝 113原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值