@Override public <VALUE> VALUE remove(Class<? extends Key<VALUE>> key) { return label.remove(key); }
/** * Splits a compound marked by the lexer. */ private CoreLabel processCompound(CoreLabel cl) { cl.remove(ParentAnnotation.class); String[] parts = cl.word().replaceAll("-", " - ").split("\\s+"); for (String part : parts) { CoreLabel newLabel = new CoreLabel(cl); newLabel.setWord(part); newLabel.setValue(part); newLabel.set(OriginalTextAnnotation.class, part); compoundBuffer.add(newLabel); } return compoundBuffer.remove(0); }
/** * Set the word value for the label. Also, clears the lemma, since * that may have changed if the word changed. */ @Override public void setWord(String word) { String originalWord = get(CoreAnnotations.TextAnnotation.class); set(CoreAnnotations.TextAnnotation.class, word); // Pado feb 09: if you change the word, delete the lemma. // Gabor dec 2012: check if there was a real change -- this remove is actually rather expensive if it gets called a lot // todo [cdm 2015]: probably no one now knows why this was even needed, but maybe it should just be removed. It's kind of weird. if (word != null && !word.equals(originalWord) && containsKey(CoreAnnotations.LemmaAnnotation.class)) { remove(CoreAnnotations.LemmaAnnotation.class); } }
cl.remove(ParentAnnotation.class); String word = cl.word(); String first;
/** * Splits a compound marked by the lexer. */ private CoreLabel processCompound(CoreLabel cl) { cl.remove(ParentAnnotation.class); String[] parts = pSpace.split(pDash.matcher(cl.word()).replaceAll(" - ")); int lengthAccum = 0; for (String part : parts) { CoreLabel newLabel = new CoreLabel(cl); newLabel.setWord(part); newLabel.setValue(part); newLabel.setBeginPosition(cl.beginPosition() + lengthAccum); newLabel.setEndPosition(cl.beginPosition() + lengthAccum + part.length()); newLabel.set(OriginalTextAnnotation.class, part); compoundBuffer.add(newLabel); lengthAccum += part.length(); } return compoundBuffer.remove(0); }
cl.remove(ParentAnnotation.class); String word = cl.word(); String first;
/** * Annotate a document (which is usually just a sentence). */ public void annotate(StanfordCoreNLP pipeline, Annotation ann) { if (ann.get(CoreAnnotations.SentencesAnnotation.class) == null) { pipeline.annotate(ann); } else { if (ann.get(CoreAnnotations.SentencesAnnotation.class).size() == 1) { CoreMap sentence = ann.get(CoreAnnotations.SentencesAnnotation.class).get(0); for (CoreLabel token : sentence.get(CoreAnnotations.TokensAnnotation.class)) { token.remove(NaturalLogicAnnotations.OperatorAnnotation.class); token.remove(NaturalLogicAnnotations.PolarityAnnotation.class); } sentence.remove(NaturalLogicAnnotations.RelationTriplesAnnotation.class); sentence.remove(NaturalLogicAnnotations.EntailedSentencesAnnotation.class); sentence.remove(SemanticGraphCoreAnnotations.BasicDependenciesAnnotation.class); sentence.remove(SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation.class); sentence.remove(SemanticGraphCoreAnnotations.EnhancedPlusPlusDependenciesAnnotation.class); pipeline.annotate(ann); } } }
/** * Handles verbs with attached suffixes, marked by the lexer: * * Escribamosela => Escribamo + se + la => escribamos + se + la * Sentaos => senta + os => sentad + os * Damelo => da + me + lo * */ private CoreLabel processVerb(CoreLabel cl) { cl.remove(ParentAnnotation.class); SpanishVerbStripper.StrippedVerb stripped = verbStripper.separatePronouns(cl.word()); if (stripped == null) { return cl; } // Split the CoreLabel into separate labels, tracking changing begin + end // positions. int stemEnd = cl.beginPosition() + stripped.getOriginalStem().length(); int lengthRemoved = 0; for (String pronoun : stripped.getPronouns()) { int beginOffset = stemEnd + lengthRemoved; compoundBuffer.add(copyCoreLabel(cl, pronoun, beginOffset)); lengthRemoved += pronoun.length(); } CoreLabel stem = copyCoreLabel(cl, stripped.getStem(), cl.beginPosition(), stemEnd); stem.setOriginalText(stripped.getOriginalStem()); return stem; }
mention.corefClusterID); mention.headWord.remove(CorefCoreAnnotations.CorefClusterIdAnnotation.class);
CoreLabel cl = (CoreLabel) t.label(); cl.set(SentimentCoreAnnotations.SentimentClass.class, str); cl.remove(CoreAnnotations.SpanAnnotation.class);
token.remove(TimeAnnotations.TimexAnnotation.class);
@Override public <VALUE> VALUE remove(Class<? extends Key<VALUE>> key) { return label.remove(key); }
@Override public <VALUE> VALUE remove(Class<? extends Key<VALUE>> key) { return label.remove(key); }
/** * {@inheritDoc} */ public void setWord(String word) { set(TextAnnotation.class, word); // pado feb 09: if you change the word, delete the lemma. remove(LemmaAnnotation.class); }
/** * Set the word value for the label. Also, clears the lemma, since * that may have changed if the word changed. */ @Override public void setWord(String word) { set(CoreAnnotations.TextAnnotation.class, word); // pado feb 09: if you change the word, delete the lemma. remove(CoreAnnotations.LemmaAnnotation.class); }
/** * Set the word value for the label. Also, clears the lemma, since * that may have changed if the word changed. */ @Override public void setWord(String word) { String originalWord = get(CoreAnnotations.TextAnnotation.class); set(CoreAnnotations.TextAnnotation.class, word); // Pado feb 09: if you change the word, delete the lemma. // Gabor dec 2012: check if there was a real change -- this remove is actually rather expensive if it gets called a lot // todo [cdm 2015]: probably no one now knows why this was even needed, but maybe it should just be removed. It's kind of weird. if (word != null && !word.equals(originalWord) && containsKey(CoreAnnotations.LemmaAnnotation.class)) { remove(CoreAnnotations.LemmaAnnotation.class); } }