Skip to content

Commit

Permalink
Add a logging line which tells us which tags are in the tagger used b…
Browse files Browse the repository at this point in the history
…y the srparser
  • Loading branch information
AngledLuffa committed Oct 17, 2024
1 parent 83b38bb commit 614b936
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,8 @@ private void train(List<Pair<String, FileFilter>> trainTreebankPath,
if (op.testOptions.preTag) {
Timing retagTimer = new Timing();
tagger = Tagger.loadModel(op.testOptions.taggerSerializedFile);
log.info("Retagging with tagger model: " + op.testOptions.taggerSerializedFile);
log.info("Known tags in the tagger model: " + tagger.tagSet());
redoTags(binarizedTrees, tagger, nThreads);
retagTimer.done("Retagging");
}
Expand Down
3 changes: 3 additions & 0 deletions src/edu/stanford/nlp/tagger/common/Tagger.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package edu.stanford.nlp.tagger.common;

import java.util.List;
import java.util.Set;

import edu.stanford.nlp.ling.HasWord;
import edu.stanford.nlp.ling.TaggedWord;
Expand All @@ -24,6 +25,8 @@ public abstract class Tagger implements Function<List<? extends HasWord>,List<Ta
@Override
public abstract List<TaggedWord> apply(List<? extends HasWord> in);

public abstract Set<String> tagSet();

public static Tagger loadModel(String path) {
// TODO: we can avoid ReflectionLoading if we instead use the
// serialization mechanism in MaxentTagger. Similar to ParserGrammar
Expand Down
1 change: 1 addition & 0 deletions src/edu/stanford/nlp/tagger/maxent/MaxentTagger.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ public String getTag(int index) {
return tags.getTag(index);
}

@Override
public Set<String> tagSet() {
return tags.tagSet();
}
Expand Down

0 comments on commit 614b936

Please sign in to comment.