Skip to content

Commit 8659653

Browse files
committed
... also fix the optional output for disjunctions
1 parent a9965b2 commit 8659653

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,15 @@ public String toString() {
5858
if (isNegated()) {
5959
sb.append("!");
6060
}
61+
if (isOptional()) {
62+
sb.append("?");
63+
}
6164
sb.append('[');
6265
for (Iterator<TregexPattern> iter = children.iterator(); iter.hasNext();) {
6366
TregexPattern node = iter.next();
6467
sb.append(node.toString());
6568
if (iter.hasNext()) {
66-
sb.append(" |");
69+
sb.append(" | ");
6770
}
6871
}
6972
sb.append(']');

test/src/edu/stanford/nlp/trees/tregex/TregexTest.java

+3
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,9 @@ public void testOptionalToString() {
15661566

15671567
pattern = TregexPattern.compile("A ?< B");
15681568
assertEquals("Root (A ?< B )", pattern.toString());
1569+
1570+
pattern = TregexPattern.compile("A ?[< B | < C]");
1571+
assertEquals("Root (A ?[< B | < C ])", pattern.toString());
15691572
}
15701573

15711574
/**

0 commit comments

Comments
 (0)