rmuir commented on issue #13706:
URL: https://github.com/apache/lucene/issues/13706#issuecomment-2324856962

   This is just what i'm mulling over now, relaxing `isTotal` to no longer 
require a minimal DFA:
   ```
   diff --git 
a/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java 
b/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java
   index 2052b1c50bf..0de4ac013ee 100644
   --- a/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java
   +++ b/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java
   @@ -864,15 +864,22 @@ public final class Operations {
    
      /**
       * Returns true if the given automaton accepts all strings for the 
specified min/max range of the
   -   * alphabet. The automaton must be minimized.
   +   * alphabet. The automaton must be deterministic with no transitions to 
dead states.
       */
      public static boolean isTotal(Automaton a, int minAlphabet, int 
maxAlphabet) {
   -    if (a.isAccept(0) && a.getNumTransitions(0) == 1) {
   +    // minimal case
   +    if (a.getNumState() == 0 && 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;
        }
   -    return false;
   +    // deterministic case
   +    Automaton a2 = new Automaton();
   +    int s = a2.createState();
   +    a2.setAccept(s, true);
   +    a2.addTransition(s, s, minAlphabet, maxAlphabet);
   +    a2.finishState();
   +    return sameLanguage(a, a2);
      }
    
      /**
   ```


-- 
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

Reply via email to