简体   繁体   中英

Configure SUTime for StanfordNLP in Spanish - Java

I'm having trouble setting the SUTime in the spanish version that comes with in the stanford-spanish-corenlp-2018-10-05-models.jar

In Stanford documents it says that the options ner.applyNumericClassifiers = true and ner.useSUTime = true is only valid for the English version, but the spanish jar comes with a spanish.sutime.txt included and I would like for it to work.

I tried with this code:

Properties props = new Properties();
props.put("annotators", "tokenize, ssplit, pos, lemma, ner");

props.setProperty("tokenize.language", "es");
...         
...
props.setProperties("sutime.rules", "edu/stanford/nlp/models/sutime/spanish.sutime.txt");

I don't really know how to move on and I haven't seen this issue in any other question, maybe someone can help me.

Spanish will run SUTime by defaulting 3.9.2. You can just use these properties:

ner.model = edu/stanford/nlp/models/ner/spanish.ancora.distsim.s512.crf.ser.gz
ner.applyNumericClassifiers = true
ner.useSUTime = true
ner.language = es

You can get the default Spanish properties with:

Properties props = LanguageInfo.getLanguageProperties("spanish");

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