@@ -58,6 +58,7 @@ private UniversalPOSMapper() {} // static methods
5858 public static void load () {
5959 transformer = new DependencyTreeTransformer ();
6060
61+ TregexPatternCompiler compiler = new TregexPatternCompiler (new UniversalSemanticHeadFinder (true ));
6162 operations = new ArrayList <>();
6263 // ------------------------------
6364 // Context-sensitive mappings
@@ -71,7 +72,7 @@ public static void load() {
7172 { "TO=target <... {/.*/}" , "ADP" , }, // otherwise TO -> ADP
7273 };
7374 for (String [] newOp : toContextMappings ) {
74- operations .add (new Pair <>(TregexPattern .compile (newOp [0 ]),
75+ operations .add (new Pair <>(compiler .compile (newOp [0 ]),
7576 Tsurgeon .parseOperation ("relabel target " + newOp [1 ])));
7677
7778 }
@@ -96,7 +97,7 @@ public static void load() {
9697 if (DEBUG ) {
9798 System .err .println (newTregex + "\n " + newTsurgeon );
9899 }
99- operations .add (new Pair <>(TregexPattern .compile (newTregex ),
100+ operations .add (new Pair <>(compiler .compile (newTregex ),
100101 Tsurgeon .parseOperation (newTsurgeon )));
101102 }
102103
@@ -152,7 +153,7 @@ public static void load() {
152153 { "WDT=target <... {/.*/}" , "DET" },
153154 };
154155 for (String [] newOp : otherContextMappings ) {
155- operations .add (new Pair <>(TregexPattern .compile (newOp [0 ]),
156+ operations .add (new Pair <>(compiler .compile (newOp [0 ]),
156157 Tsurgeon .parseOperation ("relabel target " + newOp [1 ])));
157158
158159 }
@@ -194,7 +195,7 @@ public static void load() {
194195 {"XX" , "X" },
195196 };
196197 for (String [] newOp : one2oneMappings ) {
197- operations .add (new Pair <>(TregexPattern .compile (newOp [0 ] + "=target <: __" ),
198+ operations .add (new Pair <>(compiler .compile (newOp [0 ] + "=target <: __" ),
198199 Tsurgeon .parseOperation ("relabel target " + newOp [1 ])));
199200
200201 }
0 commit comments