Skip to content

Commit 404adab

Browse files
committed
Remove single dependency of another package on edu.stanford.nlp.patterns
1 parent afb7692 commit 404adab

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/src/edu/stanford/nlp/semgraph/semgrex/SemgrexPatternTest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import edu.stanford.nlp.io.IOUtils;
1313
import edu.stanford.nlp.ling.*;
14-
import edu.stanford.nlp.patterns.PatternsAnnotations;
1514
import edu.stanford.nlp.semgraph.SemanticGraph;
1615
import edu.stanford.nlp.semgraph.SemanticGraphFactory;
1716
import edu.stanford.nlp.trees.*;
@@ -138,14 +137,21 @@ public void testMacro() throws IOException {
138137
throw new RuntimeException("failed!");
139138
}
140139

140+
private static class PatternLabelAnnotation implements CoreAnnotation<String> {
141+
@Override
142+
public Class<String> getType() {
143+
return String.class;
144+
}
145+
}
146+
141147
public void testEnv() throws IOException {
142148
SemanticGraph h = SemanticGraph.valueOf("[married/VBN nsubjpass>Hughes/NNP auxpass>was/VBD nmod:to>Gracia/NNP]");
143-
h.getFirstRoot().set(PatternsAnnotations.PatternLabel1.class,"YES");
149+
h.getFirstRoot().set(PatternLabelAnnotation.class,"YES");
144150
//SemanticGraph t = SemanticGraph
145151
// .valueOf("[loved/VBD\nnsubj:Hughes/NNP\ndobj:[wife/NN poss:his/PRP$ appos:Gracia/NNP]\nconj_and:[obsessed/JJ\ncop:was/VBD\nadvmod:absolutely/RB\nprep_with:[Elicia/NN poss:his/PRP$ amod:little/JJ nn:daughter/NN]]]");
146152
String macro = "macro WORD = married";
147153
Env env = new Env();
148-
env.bind("pattern1",PatternsAnnotations.PatternLabel1.class);
154+
env.bind("pattern1",PatternLabelAnnotation.class);
149155
String pattern = "({pattern1:YES}=parent >>nsubjpass {}=node)";
150156
List<SemgrexPattern> pats = SemgrexBatchParser.compileStream(new ByteArrayInputStream((macro + "\n" + pattern).getBytes(StandardCharsets.UTF_8)), env);
151157
SemgrexPattern pat3 = pats.get(0);

0 commit comments

Comments
 (0)