rmuir commented on issue #13706: URL: https://github.com/apache/lucene/issues/13706#issuecomment-2325100044
See PR: #13707, I took a different approach which solves the practical problem without doing scary stuff. ``` public static boolean isTotal(Automaton a, int minAlphabet, int maxAlphabet) { + // allows some "fuzziness" to detect non-minimal forms such as those from RegExp if (a.isAccept(0) && a.getNumTransitions(0) == 1) { Transition t = new Transition(); a.getTransition(0, 0, t); - return t.dest == 0 && t.min == minAlphabet && t.max == maxAlphabet; + int state = t.dest; + if (t.min == minAlphabet + && t.max == maxAlphabet + && a.isAccept(state) + && a.getNumTransitions(state) == 1) { + a.getTransition(state, 0, t); + return t.dest == state && t.min == minAlphabet && t.max == maxAlphabet; + } } return false; } ``` -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org