Skip to content

Commit

Permalink
Run a TreeTransformer that gets rid of the functional tags other than…
Browse files Browse the repository at this point in the history
… TMP on the NPs before using the POS conversions. This also greatly reduces the number of validation errors, especially thanks to the AUX rules now matching for NP-stuff whereas before it would not match those
  • Loading branch information
AngledLuffa committed Mar 14, 2024
1 parent ce33462 commit 396741e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/edu/stanford/nlp/trees/UniversalPOSMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@ public class UniversalPOSMapper {

private static List<Pair<TregexPattern, TsurgeonPattern>> operations; // = null;

private static TreeTransformer transformer;

private UniversalPOSMapper() {} // static methods

public static void load() {
transformer = new DependencyTreeTransformer();

operations = new ArrayList<>();
// ------------------------------
// Context-sensitive mappings
Expand Down Expand Up @@ -206,7 +210,9 @@ public static Tree mapTree(Tree t) {
return t;
}

return Tsurgeon.processPatternsOnTree(operations, t.deepCopy());
t = t.deepCopy();
t = transformer.transformTree(t);
return Tsurgeon.processPatternsOnTree(operations, t);
}

}

0 comments on commit 396741e

Please sign in to comment.