예제 #1
0
                    words.append(Y)
        return words


if __name__ == "__main__":
    import sys
    import pickle
    from iadfa import IncrementalAdfa
    sys.argv = sys.argv[1:]

    etr = ErrorTolerantRecognizer()
    pFile = "test4.pickle"
    if "--gen" in sys.argv:
        sys.argv.remove("--gen")
        file = open("test.dico", "r")
        words = []
        for word in file:
            if word[-1] == "\n":
                word = word[:-1]
            words.append(word)
        words.sort()
        iadfa = IncrementalAdfa(words, sorted=True)
        pickle.dump(iadfa, open(pFile, "w"))
    else:
        iadfa = pickle.load(open(pFile, "r"))
    if "--export" in sys.argv:
        sys.argv.remove("--export")
        iadfa.graphVizExport("test4.dot")

    etr.recognize(sys.argv[0], iadfa, 2)
예제 #2
0
파일: et.py 프로젝트: datamade/moman
                    words.append(Y)
        return words


if __name__ == "__main__":
    import sys
    import pickle
    from iadfa import IncrementalAdfa
    sys.argv = sys.argv[1:]

    etr = ErrorTolerantRecognizer()
    pFile = "test4.pickle"
    if "--gen" in sys.argv:
        sys.argv.remove("--gen")
        file = open("test.dico", "r")
        words = []
        for word in file:
            if word[-1] == "\n":
                word = word[:-1]
            words.append(word)
        words.sort()
        iadfa = IncrementalAdfa(words, sorted = True)
        pickle.dump(iadfa, open(pFile,"w")) 
    else:
        iadfa = pickle.load(open(pFile, "r"))
    if "--export" in sys.argv:
        sys.argv.remove("--export")
        iadfa.graphVizExport("test4.dot")

    etr.recognize(sys.argv[0],iadfa,2)
예제 #3
0
from iadfa import IncrementalAdfa

f = ["append", "appendice", "bappend"]

fsa = IncrementalAdfa(f, sorted = True)
fsa.graphVizExport("test.dot")