Git Product home page Git Product logo

automata-from-regex's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

automata-from-regex's Issues

Some trouble while in minimizing DFA(already fixed for you)

Encountering some trouble while comparing equal status:
It's not equal while a status is in ending states , and another one is not in ending stats:
Fixed with coming codes:

def minimise(self):
    states = list(self.dfa.states)
    n = len(states)
    unchecked = dict()
    count = 1
    distinguished = []
    equivalent = dict(zip(range(len(states)), [{s} for s in states]))
    pos = dict(zip(states, range(len(states))))
    for i in range(n - 1):
        for j in range(i + 1, n):
            if not ([states[i], states[j]] in distinguished or [states[j], states[i]] in distinguished):
                if (states[i] in self.dfa.finalstates and states[j] not in self.dfa.finalstates) or (states[i] not in self.dfa.finalstates and states[j] in self.dfa.finalstates):
                    distinguished.append([states[i], states[j]])
                    continue
                eq = 1
                toappend = []
                for char in self.dfa.language:
                    s1 = self.dfa.gettransitions(states[i], char)
                    print "debug trans "
                    print s1
                    s2 = self.dfa.gettransitions(states[j], char)
                    if len(s1) != len(s2):
                        eq = 0
                        break
                    if len(s1) > 1:
                        raise BaseException("Multiple transitions detected in DFA")
                    elif len(s1) == 0:
                        continue
                    s1 = s1.pop()
                    s2 = s2.pop()
                    if s1 != s2:
                        if [s1, s2] in distinguished or [s2, s1] in distinguished:
                            eq = 0
                            break
                        else:
                            toappend.append([s1, s2, char])
                            eq = -1
                if eq == 0:
                    distinguished.append([states[i], states[j]])
                elif eq == -1:
                    s = [states[i], states[j]]
                    s.extend(toappend)
                    unchecked[count] = s
                    count += 1
                else:
                    p1 = pos[states[i]]
                    p2 = pos[states[j]]
                    if p1 != p2:
                        st = equivalent.pop(p2)
                        for s in st:
                            pos[s] = p1
                        equivalent[p1] = equivalent[p1].union(st)
    newFound = True
    while newFound and len(unchecked) > 0:
        newFound = False
        toremove = set()
        for p, pair in unchecked.items():
            for tr in pair[2:]:
                if [tr[0], tr[1]] in distinguished or [tr[1], tr[0]] in distinguished:
                    unchecked.pop(p)
                    distinguished.append([pair[0], pair[1]])
                    newFound = True
                    break
    for pair in unchecked.values():
        p1 = pos[pair[0]]
        p2 = pos[pair[1]]
        if p1 != p2:
            st = equivalent.pop(p2)
            for s in st:
                pos[s] = p1
            equivalent[p1] = equivalent[p1].union(st)
    if len(equivalent) == len(states):
        self.minDFA = self.dfa
    else:
        self.minDFA = self.dfa.newBuildFromEquivalentStates(equivalent, pos)

DFA from NFA class problem

hi, when i try to create new DFAfromNFA with arguement of constructor- object created with NFAfromRegex i get "AttributeError: 'NFAfromRegex' object has no attribute 'getEClose'"
because this attribute is in Automata class. How can i solve this problem.
Thank you!

use sign chars ( + - " ' )

how to use sign chars ( + - " ' ) in regular expression entry ?
Ex:
"[a-zA-Z0-9]"
how to enter this ????
at first comes double qoutation the chars from a to z or A to Z or 0 - 9 and at last double qoutation again

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.