简体   繁体   English

使用C#更改Stanford NLP Maxent Tagger中的pos标签分隔符

[英]Change pos tag separator in Stanford NLP Maxent Tagger using C#

I have the Stanford POS tagging working with C# by following the instructions on this page https://sergey-tihon.github.io/Stanford.NLP.NET/StanfordPOSTagger.html 按照此页面上的说明,我让Stanford POS标签与C#一起使用https://sergey-tihon.github.io/Stanford.NLP.NET/StanfordPOSTagger.html

The results are: 结果是:

A/DT Part-Of-Speech/NNP Tagger/NNP -LRB-/-LRB- POS/NNP Tagger/ (…etc…)

I would like to change the tag separator from the slash character (/) to an underscore (_). 我想将标签分隔符从斜杠(/)更改为下划线(_)。

I have looked in the properties file 我看过属性文件

wsj-0-18-bidirectional-distsim.tagger.props WSJ-0-18-双向distsim.tagger.props

and it already has the line: tagSeparator = _ 并且已经有一行:tagSeparator = _

According to the answer on this page edit config file in stanford pos tagger and the example on this page https://sergey-tihon.github.io/Stanford.NLP.NET/StanfordCoreNLP.html it seems that I should be able to change the tagger's properties by adding the following code: 根据此页面上的答案,斯坦福pos tagger中的编辑配置文件和此页面上的示例https://sergey-tihon.github.io/Stanford.NLP.NET/StanfordCoreNLP.html ,看来我应该能够进行更改通过添加以下代码来添加标记器的属性:

var props = new Properties();
props.setProperty("tagSeparator", "_");

However this approach does not work as the first line will not compile, giving the syntax error: 但是,此方法不起作用,因为第一行将无法编译,从而产生语法错误:

'Properties' is a namespace but is used like a type “属性”是一个名称空间,但其使用方式类似于类型

I have not found a way to change the separator to an underscore. 我尚未找到将分隔符更改为下划线的方法。

All help is appreciated. 感谢所有帮助。

Try rewriting 尝试重写

var props = new Properties();

as

var props = new java.util.Properties();

and it should work. 它应该工作。

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

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