简体   繁体   English

从SyntaxNet获取输出为python对象,而不是文本

[英]Get output from SyntaxNet as python object, not text

After executing some of an example syntaxnet scripts(like parse.sh ) I receive output in text-conll format. 执行一些示例syntaxnet脚本(如parse.sh )后,我收到text-conll格式的输出。 My goal is to take some features and proceed them to next network. 我的目标是采用一些功能并将它们带到下一个网络。 One possible choice is to parse text output with something like nltk.corpus.reader.ConllCorpusReader to a python object. 一种可能的选择是使用类似nltk.corpus.reader.ConllCorpusReader文本输出解析为python对象。 But for me interesting is: 但对我来说有趣的是:

It is possible with some code modification to get from SyntaxNet not text, but Python object related to parsed results? 通过一些代码修改可以从SyntaxNet获取而不是文本,但Python对象与解析结果相关吗?

I've found that in parser_eval.py on lines 133-138 syntaxnet fetched already text version of results. 我发现,在parser_eval.py上线133-138 syntaxnet已经获取结果的文本版本。

while True:
    tf_eval_epochs, tf_eval_metrics, tf_documents = sess.run([
        parser.evaluation['epochs'],
        parser.evaluation['eval_metrics'],
        parser.evaluation['documents'],
    ])

But I cannot locate the place from what object this text was generated and how. 但我找不到这个文本生成的对象和方式。

There are many ways to do it, and from what I know all involve parsing the output of SyntaxNet, and load it into NLTK objects. 有很多方法可以做到这一点,据我所知,所有这些都涉及解析SyntaxNet的输出,并将其加载到NLTK对象中。 I wrote a simple post on my blog, exemplifying it: 我在我的博客上写了一篇简单的帖子,举例说明:

http://www.davidsbatista.net/blog/2017/03/25/syntaxnet/ http://www.davidsbatista.net/blog/2017/03/25/syntaxnet/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM