使用简单的 CoreNLP API 时如何设置分词器选项?

How to set tokenizer options when using the simple CoreNLP API?

我知道 CoreNLP 中可用的分词器选项,我知道如何在标准版本中设置它们。

有没有办法传递选项,例如untokenizable=noneKeep,当使用 Simple CoreNLP 接口时?

您可以构建一个具有属性的文档。

package edu.stanford.nlp.examples;

import edu.stanford.nlp.simple.*;

import java.util.*;

public class SimpleExample {

    public static void main(String[] args) {
        Properties props = new Properties();
        props.setProperty("tokenize.options", "untokenizable=allKeep");
        Document doc = new Document(props, "Joe Smith was born in California.  He moved to Chicago last year.");
        for (Sentence sent : doc.sentences()) {
            System.out.println(sent.tokens());
            System.out.println(sent.nerTags());
            System.out.println(sent.parse());
        }
    }

}