Skip to content

Commit

Permalink
Split the context mappings into two separate arrays - this gives us a…
Browse files Browse the repository at this point in the history
… place to reuse the AUX mappings from UniversalEnglishGrammaticalRelations
  • Loading branch information
AngledLuffa committed Mar 14, 2024
1 parent 75e8b88 commit 79833b4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/edu/stanford/nlp/trees/UniversalPOSMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,20 @@ public static void load() {
// Context-sensitive mappings
// ------------------------------

String [][] contextMappings = new String [][] {
String [][] toContextMappings = new String [][] {
// TO -> PART (in CONJP phrases)
{ "@CONJP < TO=target < VB", "PART", },
{ "@VP < @VP < (/^TO$/=target <... {/.*/})", "PART", },
{ "@VP <: (/^TO$/=target <... {/.*/})", "PART", },
{ "TO=target <... {/.*/}", "ADP", }, // otherwise TO -> ADP
};
for (String[] newOp : toContextMappings) {
operations.add(new Pair<>(TregexPattern.compile(newOp[0]),
Tsurgeon.parseOperation("relabel target " + newOp[1])));

}

String [][] otherContextMappings = new String [][] {
// Don't do this, we are now treating these as copular constructions
// VB.* -> AUX (for passives where main verb is part of an ADJP)
// @VP < (/^VB/=target < /^(?i:am|is|are|r|be|being|'s|'re|'m|was|were|been|s|ai|m|art|ar|wase|get|got|getting|gets|gotten)$/ ) < (@ADJP [ < VBN|VBD | < (@VP|ADJP < VBN|VBD) < CC ] )
Expand Down Expand Up @@ -134,7 +142,7 @@ public static void load() {
// WDT -> DET
{ "WDT=target <... {/.*/}", "DET" },
};
for (String[] newOp : contextMappings) {
for (String[] newOp : otherContextMappings) {
operations.add(new Pair<>(TregexPattern.compile(newOp[0]),
Tsurgeon.parseOperation("relabel target " + newOp[1])));

Expand Down

0 comments on commit 79833b4

Please sign in to comment.