List of usage examples for edu.stanford.nlp.coref.data CorefChain getRepresentativeMention
public CorefMention getRepresentativeMention()
From source file:edu.illinois.cs.cogcomp.pipeline.handlers.StanfordCorefHandler.java
License:Open Source License
@Override protected void addView(TextAnnotation ta) throws AnnotatorException { Annotation document = new Annotation(ta.text); pipeline.annotate(document);/*from w w w . ja va 2s .com*/ CoreferenceView vu = new CoreferenceView(viewName, ta); Map corefChain = document.get(CorefCoreAnnotations.CorefChainAnnotation.class); for (Object key : corefChain.keySet()) { CorefChain chain = (CorefChain) corefChain.get(key); Constituent representative = createConstituentGivenMention(document, chain, chain.getRepresentativeMention(), ta); List<Constituent> consList = new ArrayList<>(); for (CorefChain.CorefMention m : chain.getMentionsInTextualOrder()) { consList.add(createConstituentGivenMention(document, chain, m, ta)); } consList.remove(representative); // remove the representative itself vu.addCorefEdges(representative, consList); } ta.addView(viewName, vu); }