Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/edu/stanford/nlp/tagger/maxent/MaxentTagger.java
Original file line number Diff line number Diff line change
Expand Up @@ -1435,8 +1435,16 @@ private static String getTsvWords(boolean verbose, boolean outputLemmas,
throw new IllegalArgumentException("Expected HasTags, got " +
hw.getClass());
}
sb.append(word);
sb.append('\t');
if (outputLemmas) {
String lemma = ((HasLemma) hw).lemma();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you check that it is a HasLemma here first?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just followed original use of HasTag without check pattern.
HasWord, HasTag & HasLemma are implemented through src/edu/stanford/nlp/ling/AbstractToken.java

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that makes sense. However, the assumption is that every class that comes through the tagger will be both HasWord and HasTag, whereas if the tagger is using the WordTag class, there may not be a Lemma.

sb.append(lemma);
sb.append("\t");
}
String tag = ((HasTag) hw).tag();
sb.append(word).append('\t').append(tag).append('\n');
sb.append(tag);
sb.append('\n');
}
sb.append('\n');
return sb.toString();
Expand Down