Skip to content

Commit 94739c7

Browse files
churowAngledLuffa
authored andcommitted
Added lemmas to tsv even without verbose output format option
Check for HasLemma when converting to make a possible error a bit more readable
1 parent bf3af40 commit 94739c7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/edu/stanford/nlp/tagger/maxent/MaxentTagger.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -1435,8 +1435,19 @@ private static String getTsvWords(boolean verbose, boolean outputLemmas,
14351435
throw new IllegalArgumentException("Expected HasTags, got " +
14361436
hw.getClass());
14371437
}
1438+
sb.append(word);
1439+
sb.append('\t');
1440+
if (outputLemmas) {
1441+
if (!(hw instanceof HasLemma)) {
1442+
throw new IllegalArgumentException("Expected HasLemma with the outputLemmas set, but got class " + hw.getClass());
1443+
}
1444+
String lemma = ((HasLemma) hw).lemma();
1445+
sb.append(lemma);
1446+
sb.append("\t");
1447+
}
14381448
String tag = ((HasTag) hw).tag();
1439-
sb.append(word).append('\t').append(tag).append('\n');
1449+
sb.append(tag);
1450+
sb.append('\n');
14401451
}
14411452
sb.append('\n');
14421453
return sb.toString();

0 commit comments

Comments
 (0)