@@ -58,6 +58,7 @@ private UniversalPOSMapper() {} // static methods
58
58
public static void load () {
59
59
transformer = new DependencyTreeTransformer ();
60
60
61
+ TregexPatternCompiler compiler = new TregexPatternCompiler (new UniversalSemanticHeadFinder (true ));
61
62
operations = new ArrayList <>();
62
63
// ------------------------------
63
64
// Context-sensitive mappings
@@ -71,7 +72,7 @@ public static void load() {
71
72
{ "TO=target <... {/.*/}" , "ADP" , }, // otherwise TO -> ADP
72
73
};
73
74
for (String [] newOp : toContextMappings ) {
74
- operations .add (new Pair <>(TregexPattern .compile (newOp [0 ]),
75
+ operations .add (new Pair <>(compiler .compile (newOp [0 ]),
75
76
Tsurgeon .parseOperation ("relabel target " + newOp [1 ])));
76
77
77
78
}
@@ -96,7 +97,7 @@ public static void load() {
96
97
if (DEBUG ) {
97
98
System .err .println (newTregex + "\n " + newTsurgeon );
98
99
}
99
- operations .add (new Pair <>(TregexPattern .compile (newTregex ),
100
+ operations .add (new Pair <>(compiler .compile (newTregex ),
100
101
Tsurgeon .parseOperation (newTsurgeon )));
101
102
}
102
103
@@ -152,7 +153,7 @@ public static void load() {
152
153
{ "WDT=target <... {/.*/}" , "DET" },
153
154
};
154
155
for (String [] newOp : otherContextMappings ) {
155
- operations .add (new Pair <>(TregexPattern .compile (newOp [0 ]),
156
+ operations .add (new Pair <>(compiler .compile (newOp [0 ]),
156
157
Tsurgeon .parseOperation ("relabel target " + newOp [1 ])));
157
158
158
159
}
@@ -194,7 +195,7 @@ public static void load() {
194
195
{"XX" , "X" },
195
196
};
196
197
for (String [] newOp : one2oneMappings ) {
197
- operations .add (new Pair <>(TregexPattern .compile (newOp [0 ] + "=target <: __" ),
198
+ operations .add (new Pair <>(compiler .compile (newOp [0 ] + "=target <: __" ),
198
199
Tsurgeon .parseOperation ("relabel target " + newOp [1 ])));
199
200
200
201
}
0 commit comments