rmuir commented on code in PR #14207:
URL: https://github.com/apache/lucene/pull/14207#discussion_r1945858708
##########
lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java:
##########
@@ -1052,6 +1052,77 @@ public static Automaton removeDeadStates(Automaton a) {
return result;
}
+ /** Merge all accept states that don't have outgoing transitions to a single
shared state. */
Review Comment:
I like the idea, couldn't we potentially use this for other operations such
as reverse() which might cause the same inefficiency as union() today?
Can we hit it with a simple random test for good feelings about it?
```java
for (int i = 0; i < N; i++) {
Automaton expected = AutomatonTestUtil.randomAutomata(random);
Automaton actual = mergeAcceptStates(expected);
assertSameLanguage(expected, actual);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]