全部代码如下
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.util.CoreMap;
import java.io.*;
import java.util.List;
public class Seg {
public static void main(String[] args) {
Segment example = new Segment();
example.runChineseAnnotators();
}
}
class Segment {
public void runChineseAnnotators(){
StanfordCoreNLP corenlp = new StanfordCoreNLP("StanfordCoreNLP-chinese.properties");
String input = "a.txt";
String output = "aout.txt"