def test1(): fst1 = TokenRegex("abc") fst2 = TokenRegex(["abc", "fff"]) fst3 = TokenRegex(["a", "b", "c", "d"]) grapth = FstGraph(fst3) grapth.draw("outfiles//test_tokenre_1")
def test4(): item1 = ["a","b","c"] item2 = [item1,item1 ] item3 = Alternate([item1,item1]) fst = FstMachine(item3) grapth = FstGraph(fst) grapth.draw("outfiles//test4")
def test4(): item1 = ["a", "b", "c"] item2 = [item1, item1] item3 = Alternate([item1, item1]) fst = TokenRegex(item3) grapth = FstGraph(fst) grapth.draw("outfiles//test4")
def test1(): fst = FstMachine("abc") fst = FstMachine(["abc","fff"]) fst = FstMachine(["a","b","c","d"]) grapth = FstGraph(fst) grapth.draw("outfiles//test1")
def test2(): item1 = Alternate(["a","b","c"]) item2 = ["d","e",item1,"f"] item3 = Alternate([item1,"d","e"]) item4 = ["z","y", item3] fst = FstMachine(item4) grapth = FstGraph(fst) grapth.draw("outfiles//test2")
def test9(): item1 = ["a", "b", "c"] item2 = [item1, item1] item3 = Alternate(["a", "a"]) item4 = Alternate([item3, item3]) fst = TokenRegex(item4) grapth = FstGraph(fst) grapth.draw("outfiles//test9")
def test8(): item1 = ["a","b","c"] item2 = [item1,item1 ] item3 = Alternate(["a","a"]) item4 = Alternate([item3 , item3]) fst = FstMachine(item4) grapth = FstGraph(fst) grapth.draw("outfiles//test8")
def test7(): item1 = [ "DL", StarRepetition([",", "DL"]), QuestionRepetition(["or", "DL"]), "DEGREE" ] fst = TokenRegex(item1) grapth = FstGraph(fst) grapth.draw("outfiles//test6")
def test2(): item1 = Alternate(["a", "b", "c"]) item2 = ["d", "e", item1, "f"] item3 = Alternate([item1, "d", "e"]) item4 = ["z", "y", item3, "x", "o"] item5 = Alternate(["z", "y", "x", "o"]) item6 = [item1, item5] fst = TokenRegex(item2) grapth = FstGraph(fst) grapth.draw("outfiles//test2")
def test6(): item1 = StarRepetition(["a", "b", "c"]) item2 = StarRepetition("r") item3 = Alternate(["d", "e"]) item4 = ["z", "y", item1, "x"] item5 = ["z", "y", item2, item3] item6 = QuestionRepetition(Alternate([item1, item2])) fst = TokenRegex(item5) grapth = FstGraph(fst) grapth.draw("outfiles//test6")
def test5(): item1 = PlusRepetition(["a", "b", "c"]) item2 = PlusRepetition("r") item3 = Alternate(["d", "e"]) item4 = ["z", "y", item3, item2] item5 = ["z", "y", item2, item3] item6 = QuestionRepetition(Alternate([item1, item2])) fst = TokenRegex(item1) grapth = FstGraph(fst) grapth.draw("outfiles//test5")
def test6(): item1 = StarRepetition(["a","b","c"]) item2 = StarRepetition("r") item3 = Alternate(["d","e"]) item4 = ["z","y", item1] item5 = ["z","y", item2,item3] item6 = QuestionRepetition( Alternate([item1, item2])) fst = FstMachine(item4) grapth = FstGraph(fst) grapth.draw("outfiles//test6")
def test5(): item1 = PlusRepetition(["a","b","c"]) item2 = PlusRepetition("r") item3 = Alternate(["d","e"]) item4 = ["z","y", item3, item2] item5 = ["z","y", item2,item3] item6 = QuestionRepetition( Alternate([item1, item2])) fst = FstMachine(item2) grapth = FstGraph(fst) grapth.draw("outfiles//test5")
def test8(): item1 = Alternate(["a", "b"]) item2 = QuestionRepetition(Alternate(["d", "e"])) item3 = StarRepetition(["f", "g"]) item4 = PlusRepetition(["h", "i"]) item8 = [item1, item2, item3, item4] fst = TokenRegex(item8) grapth = FstGraph(fst) grapth.draw("outfiles//test8")
def test3(): item1 = QuestionRepetition(["a", "b", "c"]) item2 = QuestionRepetition("r") item3 = ["d", "e", item1, "f"] item4 = ["z", "y", item2] item5 = ["z", "y", item1, item2] item6 = QuestionRepetition(Alternate([item1, item2])) item7 = ["a", "b", Alternate(["c", "d", ""]), "e"] fst = TokenRegex(item7) grapth = FstGraph(fst) grapth.draw("outfiles//test3")
def test9(): pattern1 = Alternate(["ccc","fff"]) pattern2 = [ "bbb", pattern1 ] pattern3 = [pattern2,"ggg"] pattern4 = ["bbb","ccc"] pattern5 = Alternate([pattern4,"bbb"]) pattern6 = Alternate(["bbb",pattern4]) pattern7 = Alternate([ ["bbb","ddd"],pattern4]) pattern8 = ["aaa", Alternate([pattern3, pattern7 ]) ,"ddd" ] fst = FstMachine(pattern8) grapth = FstGraph(fst) grapth.draw("outfiles//test9")
def test1(): tokens = ["aaa", "bbb", "ccc", "ddd"] pattern1 = "aaa" pattern2 = "bbb" pattern3 = ["bbb", "ccc"] pattern4 = "ddd" pattern5 = "eee" fst = TokenRegex(pattern4) track = fst._match(tokens) printTrack(track) grapth = FstGraph(fst) grapth.draw("outfiles//test_tokenre2_1")
def test1(): tokens = ["aaa","bbb","ccc","ddd"] pattern1 = "aaa" pattern2 = "bbb" pattern3 = ["bbb","ccc"] pattern4 = "ddd" pattern5 = "eee" fst = TokenRegex(pattern4) track = fst._match(tokens) printTrack(track) grapth = FstGraph(fst) grapth.draw("outfiles//test_tokenre2_1")
def test7(): pattern1 = ["DL", StarRepetition([",","DL"]), QuestionRepetition(["or","DL"]),"DEGREE" ] fst = TokenRegex(pattern1) tokens = [ "aaa","bbb","aaa","bbb","ccc","ddd","eee"] tokens = [ "DL","DEGREE"] tokens = [ "DL","or", "DL", "DEGREE"] tokens = [ "DL","," , "DL", "or", "DL", "DEGREE"] tokens = [ "DL","," , "DL", "," , "DL", "or", "DL", "DEGREE"] grapth = FstGraph(fst) grapth.draw("outfiles//test_tokenre2_6") track = fst._match(tokens) print "===================================" printTrack(track)
def test5(): tokens = [ "aaa","bbb","aaa","bbb","ccc","ddd","eee"] pattern1 = StarRepetition(["ccc","fff"]) pattern2 = StarRepetition(["aaa","bbb"]) pattern3 = ["bbb",pattern2] pattern4 = [pattern2,"ccc"] fst = TokenRegex(pattern4) grapth = FstGraph(fst) grapth.draw("outfiles//test_tokenre2_5") track = fst._match(tokens) print "===================================" printTrack(track)
def test6(): tokens = [ "aaa","bbb" ] pattern1 = [ "aaa","bbb"] pattern2 = [ "aaa","bbb","ccc"] pattern3 = Alternate([ pattern2 , [ "bbb"] ]) pattern4 = [pattern1,"ccc"] fst = TokenRegex(pattern4) grapth = FstGraph(fst) grapth.draw("outfiles//test_tokenre2_6") track = fst._match(tokens) print "===================================" printTrack(track)
def test5(): tokens = ["aaa", "bbb", "aaa", "bbb", "ccc", "ddd", "eee"] pattern1 = StarRepetition(["ccc", "fff"]) pattern2 = StarRepetition(["aaa", "bbb"]) pattern3 = ["bbb", pattern2] pattern4 = [pattern2, "ccc"] fst = TokenRegex(pattern4) grapth = FstGraph(fst) grapth.draw("outfiles//test_tokenre2_5") track = fst._match(tokens) print "===================================" printTrack(track)
def test6(): tokens = ["aaa", "bbb"] pattern1 = ["aaa", "bbb"] pattern2 = ["aaa", "bbb", "ccc"] pattern3 = Alternate([pattern2, ["bbb"]]) pattern4 = [pattern1, "ccc"] fst = TokenRegex(pattern4) grapth = FstGraph(fst) grapth.draw("outfiles//test_tokenre2_6") track = fst._match(tokens) print "===================================" printTrack(track)
def test7(): pattern1 = [ "DL", StarRepetition([",", "DL"]), QuestionRepetition(["or", "DL"]), "DEGREE" ] fst = TokenRegex(pattern1) tokens = ["aaa", "bbb", "aaa", "bbb", "ccc", "ddd", "eee"] tokens = ["DL", "DEGREE"] tokens = ["DL", "or", "DL", "DEGREE"] tokens = ["DL", ",", "DL", "or", "DL", "DEGREE"] tokens = ["DL", ",", "DL", ",", "DL", "or", "DL", "DEGREE"] grapth = FstGraph(fst) grapth.draw("outfiles//test_tokenre2_6") track = fst._match(tokens) print "===================================" printTrack(track)
def test3(): tokens = ["bbb","aaa","bbb","ccc","ddd","eee"] pattern1 = QuestionRepetition(["bbb","ccc"]) pattern2 = [ "aaa", pattern1,"ddd" ] pattern3 = [ "aaa", pattern1,"ccc" ] pattern4 = [ "aaa", pattern1,"bbb" ] pattern5 = Alternate([pattern4,"bbb"]) pattern6 = Alternate(["bbb",pattern4]) pattern7 = Alternate([ ["bbb","ddd"],pattern4]) pattern8 = [ QuestionRepetition(Alternate([pattern3, pattern4 ])) ,"ddd" ] fst = TokenRegex(pattern8) grapth = FstGraph(fst) grapth.draw("outfiles//test_tokenre2_3") track = fst._match(tokens) print "===================================" printTrack(track)
def test2(): tokens = ["000","aaa","bbb","aaa","bbb","ccc","ddd","eee"] pattern1 = Alternate(["ccc","fff"]) pattern2 = [ "bbb", pattern1 ] pattern3 = [pattern2,"ggg"] pattern4 = ["bbb","ccc"] pattern5 = Alternate([pattern4,"bbb"]) pattern6 = Alternate(["bbb",pattern4]) pattern7 = Alternate([ ["bbb","ddd"],pattern4]) pattern8 = ["aaa", Alternate([pattern3, pattern7 ]) ,"ddd" ] fst = TokenRegex(pattern8) grapth = FstGraph(fst) grapth.draw("outfiles//test_tokenre2_2") track = fst._match(tokens) print "===================================" printTrack(track)
def test2(): tokens = ["000", "aaa", "bbb", "aaa", "bbb", "ccc", "ddd", "eee"] pattern1 = Alternate(["ccc", "fff"]) pattern2 = ["bbb", pattern1] pattern3 = [pattern2, "ggg"] pattern4 = ["bbb", "ccc"] pattern5 = Alternate([pattern4, "bbb"]) pattern6 = Alternate(["bbb", pattern4]) pattern7 = Alternate([["bbb", "ddd"], pattern4]) pattern8 = ["aaa", Alternate([pattern3, pattern7]), "ddd"] fst = TokenRegex(pattern8) grapth = FstGraph(fst) grapth.draw("outfiles//test_tokenre2_2") track = fst._match(tokens) print "===================================" printTrack(track)
def test3(): tokens = ["bbb", "aaa", "bbb", "ccc", "ddd", "eee"] pattern1 = QuestionRepetition(["bbb", "ccc"]) pattern2 = ["aaa", pattern1, "ddd"] pattern3 = ["aaa", pattern1, "ccc"] pattern4 = ["aaa", pattern1, "bbb"] pattern5 = Alternate([pattern4, "bbb"]) pattern6 = Alternate(["bbb", pattern4]) pattern7 = Alternate([["bbb", "ddd"], pattern4]) pattern8 = [QuestionRepetition(Alternate([pattern3, pattern4])), "ddd"] fst = TokenRegex(pattern8) grapth = FstGraph(fst) grapth.draw("outfiles//test_tokenre2_3") track = fst._match(tokens) print "===================================" printTrack(track)
def test7(): item1 = ["DL", StarRepetition([",", "DL"]), QuestionRepetition(["or", "DL"]), "DEGREE"] fst = TokenRegex(item1) grapth = FstGraph(fst) grapth.draw("outfiles//test6")