Skip to content

Commit

Permalink
Remove the part of the CoreLabel API which removes the lemma when the…
Browse files Browse the repository at this point in the history
… word is updated. It was kinda annoying and a lot of people seem to dislike it.
  • Loading branch information
AngledLuffa committed Oct 26, 2023
1 parent 6707a52 commit c03522b
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/edu/stanford/nlp/ling/CoreLabel.java
Expand Up @@ -386,14 +386,6 @@ public final String value() {
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);
// [cdm 2021] The only unit test that depends on this code is the one that tests for this exact behavior! Remove?
// throw new IllegalStateException("Looks like your code is relying on a dirty branch in setWord() that we want to remove!");
}
}

/**
Expand Down

0 comments on commit c03522b

Please sign in to comment.