Skip to content

Commit c7bc11f

Browse files
J38AngledLuffa
authored andcommitted
only test a list of interesting annotator combinations
1 parent 79774c6 commit c7bc11f

File tree

1 file changed

+10
-43
lines changed

1 file changed

+10
-43
lines changed

itest/src/edu/stanford/nlp/pipeline/ProtobufAnnotationSerializerSlowITest.java

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -506,51 +506,18 @@ public void testShiftReduce() {
506506
}
507507

508508
/**
509-
* Is the protobuf annotator "CoreNLP complete?"
510-
* That is, does it effectively save every combination of annotators possible?
509+
* Check various pipeline combinations.
511510
*/
512511
@Test
513-
public void testAllAnnotatorCombinations() {
514-
String[] possibleAnnotators = possibleAnnotators();
515-
for (int i = 1; i < (0x1 << (possibleAnnotators.length)); ++i) {
516-
// Get annotators
517-
Set<String> annotatorsToConsider = new LinkedHashSet<>();
518-
for (int k = 0; k < possibleAnnotators.length; ++k) {
519-
int mask = (0x1 << k);
520-
if ((i & mask) != 0) { annotatorsToConsider.add(possibleAnnotators[k]); }
521-
}
522-
523-
// Sort annotators
524-
new StanfordCoreNLP(); // construct annotator pool
525-
List<String> annotators = new ArrayList<>();
526-
Set<String> annotatorsAdded = new LinkedHashSet<>();
527-
boolean wasChanged = true;
528-
while (wasChanged) {
529-
wasChanged = false;
530-
Iterator<String> iter = annotatorsToConsider.iterator();
531-
while(iter.hasNext()) {
532-
String annotator = iter.next();
533-
boolean valid = true;
534-
try {
535-
for (Class<? extends CoreAnnotation> requirement : StanfordCoreNLP.getExistingAnnotator(annotator).requires()) {
536-
if (!annotatorsAdded.contains(requirement.toString())) { valid = false; }
537-
}
538-
} catch (NullPointerException ignored) { }
539-
if (valid) {
540-
annotators.add(annotator);
541-
annotatorsAdded.add(annotator);
542-
iter.remove();
543-
wasChanged = true;
544-
}
545-
}
546-
}
547-
if (!annotatorsToConsider.isEmpty()) { continue; } // continue if we couldn't add all the annotators
548-
549-
// Create pipeline
550-
if (!annotators.contains("dcoref") && !annotators.contains("entitymentions") && !annotators.contains("cdc_tokenize")) {
551-
System.err.println(">>TESTING " + StringUtils.join(annotators, ","));
552-
testAnnotators(StringUtils.join(annotators, ","));
553-
}
512+
public void testAnnotatorCombinations() {
513+
String[] combinationsToTry = new String[]{
514+
"tokenize,ssplit,pos,truecase",
515+
"tokenize,ssplit,pos,lemma,ner,gender"
516+
};
517+
518+
for (String combination : combinationsToTry) {
519+
System.err.println(">>TESTING " + combination);
520+
testAnnotators(combination);
554521
}
555522
}
556523

0 commit comments

Comments
 (0)