import edu.stanford.nlp.pipeline.*; public class ArgotExample { public static void main(String[] args) { StanfordCoreNLP pipeline = new StanfordCoreNLP(); Annotation document = new Annotation(text); pipeline.annotate(document); List<CoreMap> sentences = document.get(CoreAnnotations.SentencesAnnotation.class); for (CoreMap sentence : sentences) { for (CoreLabel token : sentence.get(CoreAnnotations.TokensAnnotation.class)) { String word = token.get(CoreAnnotations.TextAnnotation.class); String ner = token.get(CoreAnnotations.NamedEntityTagAnnotation.class); if (!ner.equals("O")) { } } } } }


上一篇:
下一篇:
切换中文