使用opennlp进行依存句法分析
2018-04-07 00:00
966 查看
序
本文主要研究下如何使用opennlp进行依存句法分析Parser
opennlp主要使用Parser来进行依存句法分析,其模型为ParserModel@Test public void testParserTool() throws IOException { try (InputStream modelInputStream = this.getClass().getClassLoader().getResourceAsStream("chunker/en-parser-chunking.bin")) { ParserModel model = new ParserModel(modelInputStream); Parser parser = ParserFactory.create(model); String sentence = "The cow jumped over the moon"; // Used to demonstrate difference between NER and Parser // sentence = "He was the last person to see Fred."; Parse parses[] = ParserTool.parseLine(sentence, parser, 3); for (Parse parse : parses) { parse.show(); } } catch (IOException ex) { ex.printStackTrace(); } }
这里使用en-parser-chunking.bin这个训练好的模型来进行分析
第一句输出如下
(TOP (PP (S (NP (DT The) (NN cow)) (PP (VP (VBD jumped) (PRT (RP over))))) (NP (DT the) (NN moon)))) (TOP (NP (NP (DT The) (NN cow)) (PP (S (VP (VBN jumped) (PP (IN over) (NP (DT the) (NN moon)))))))) (TOP (NP (NP (DT The) (NN cow)) (SBAR (S (VP (VBN jumped) (PP (IN over) (NP (DT the) (NN moon))))))))
第二句输出如下
(TOP (FRAG (FRAG (S (NP (PRP He)) (VP (VBD was) (NP (NP (DT the) (JJ last) (NN person)) (SBAR (S (VP (TO to) (VP (VB see))))))))) (: Fred.))) (TOP (S (S (NP (PRP He)) (VP (VBD was) (NP (NP (DT the) (JJ last) (NN person)) (PP (VP (TO to) (VP (VB see))))))) (: Fred.))) (TOP (S (FRAG (S (NP (PRP He)) (VP (VBD was) (NP (NP (DT the) (JJ last) (NN person)) (SBAR (S (VP (TO to) (VP (VB see))))))))) (: Fred.)))
小结
opennlp也支持依存句法分析,不过根节点的表示,stanford nlp使用的是ROOT,而opennlp使用的是TOP。doc
tools.parser.parsing相关文章推荐
- 使用stanford nlp进行依存句法分析
- 使用opennlp进行文档分类
- 使用FudanNLP实现依存句法分析
- nlp--使用NLTK进行简单文本分析
- 使用Stanford CoreNLP的Python封装包处理中文(分词、词性标注、命名实体识别、句法树、依存句法分析)
- 【已解决】win10环境下基于nltk搭建stanford parser环境,进行中文依存句法分析
- 【已解决】win10环境下基于nltk搭建stanford parser环境,进行中文依存句法分析
- 使用opennlp进行词性标注
- nlp 总结 分词,词义消歧,词性标注,命名体识别,依存句法分析,语义角色标注
- Linux下使用Iptraf进行网络流量的分析
- [转]使用dottrace2.0进行性能分析简介
- 使用IDA5.0进行VB的逆向分析--如何减轻我的工作量?
- 使用spotligh+sqltuning+loadrunner对数据库性能问题进行定位和分析
- 使用pgRouting进行路径分析
- 开发者视角:使用VSTS进行应用程序分析和单元测试(下)
- HtmlParser初探--使用Nodefilter和Visitor进行网页分析
- 使用Perf4J进行性能分析和监控
- 使用JRockit Mission Control进行性能分析和调优
- 使用Gnu gprof进行Linux平台下的程序分析
- 系统遭受入侵后使用TCT进行紧急恢复并分析