diff --git a/src/edu/stanford/nlp/tagger/maxent/MaxentTagger.java b/src/edu/stanford/nlp/tagger/maxent/MaxentTagger.java index 6d7d20f88c..b554383d3e 100644 --- a/src/edu/stanford/nlp/tagger/maxent/MaxentTagger.java +++ b/src/edu/stanford/nlp/tagger/maxent/MaxentTagger.java @@ -1435,8 +1435,19 @@ private static String getTsvWords(boolean verbose, boolean outputLemmas, throw new IllegalArgumentException("Expected HasTags, got " + hw.getClass()); } + sb.append(word); + sb.append('\t'); + if (outputLemmas) { + if (!(hw instanceof HasLemma)) { + throw new IllegalArgumentException("Expected HasLemma with the outputLemmas set, but got class " + hw.getClass()); + } + String lemma = ((HasLemma) hw).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();