Skip to content

Commit ea33924

Browse files
committed
Change it so that __ matches null. Migth have some interesting effects on any existing patterns which rely on the previous null behavior, but that behavior was extremely confusing to predict
1 parent 38dc958 commit ea33924

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/edu/stanford/nlp/trees/tregex/DescriptionPattern.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,11 @@ private void goToNextTreeNodeMatch() {
380380
break;
381381
}
382382
} else { // try to match the description pattern.
383-
// cdm: Nov 2006: Check for null label, just make found false
384-
// String value = (myNode.basicCatFunction == null ? nextTreeNodeMatchCandidate.value() : myNode.basicCatFunction.apply(nextTreeNodeMatchCandidate.value()));
385-
// m = myNode.descPattern.matcher(value);
386-
// boolean found = m.find();
387383
boolean found;
388384
value = nextTreeNodeMatchCandidate.value();
389385
if (value == null) {
390-
found = false;
386+
// treat null as a match only if if we are matching __, /.*/, or the like
387+
found = myNode.descriptionMode == DescriptionMode.ANYTHING;
391388
} else {
392389
if (myNode.basicCatFunction != null) {
393390
value = myNode.basicCatFunction.apply(value);
@@ -451,6 +448,8 @@ private void goToNextTreeNodeMatch() {
451448
} else if (value != null) {
452449
// commit using a set string (all groups are treated as the string)
453450
commitVariableGroups(value);
451+
} else {
452+
commitVariableGroups("");
454453
}
455454
}
456455
// finished is false exiting this if and only if nextChild exists

0 commit comments

Comments
 (0)