List of usage examples for edu.stanford.nlp.coref.data CorefChain getChainID
public int getChainID()
From source file:edu.illinois.cs.cogcomp.pipeline.handlers.StanfordCorefHandler.java
License:Open Source License
private static Constituent createConstituentGivenMention(Annotation document, CorefChain chain, CorefChain.CorefMention m, TextAnnotation ta) { Pair<Integer, Integer> mentionCharSpan = getCharIntervalFromCorefMention(document, m.sentNum, m.startIndex, m.endIndex);/*from ww w . j a va 2s.c o m*/ List<Constituent> overlappingCons = ta.getView(ViewNames.TOKENS) .getConstituentsOverlappingCharSpan(mentionCharSpan.getFirst(), mentionCharSpan.getSecond()); int startIndex = overlappingCons.stream().min(Comparator.comparing(Constituent::getStartSpan)).get() .getStartSpan(); int endIndex = overlappingCons.stream().max(Comparator.comparing(Constituent::getEndSpan)).get() .getEndSpan(); Constituent c = new Constituent(String.valueOf(chain.getChainID()), viewName, ta, startIndex, endIndex); c.addAttribute("animacy", m.animacy.toString()); c.addAttribute("number", m.number.toString()); c.addAttribute("gender", m.gender.toString()); c.addAttribute("mentionType", m.mentionType.toString()); return c; }