Skip to content

Commit f9ee36f

Browse files
committed
Ssurgeon KillNonRootedNodes: comment on how this works
1 parent 7ad1d9c commit f9ee36f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/KillNonRootedNodes.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class KillNonRootedNodes extends SsurgeonEdit {
2424
@Override
2525
public boolean evaluate(SemanticGraph sg, SemgrexMatcher sm) {
2626
boolean changed = false;
27+
// keep a separate list so that deleting items doesn't affect the iteration
2728
List<IndexedWord> nodes = new ArrayList<>(sg.vertexSet());
2829
for (IndexedWord node : nodes) {
2930
List<IndexedWord> rootPath = sg.getPathToRoot(node);
@@ -33,7 +34,7 @@ public boolean evaluate(SemanticGraph sg, SemgrexMatcher sm) {
3334
}
3435
return changed;
3536
}
36-
37+
3738
@Override
3839
public String toEditString() {
3940
StringWriter buf = new StringWriter();

0 commit comments

Comments
 (0)