简体   繁体   中英

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

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

and it already has the line: 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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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