From c0cff3b1bba2f20398a06fe0ca853a301ae17c9f Mon Sep 17 00:00:00 2001 From: timv Date: Thu, 6 Jun 2013 23:53:01 -0400 Subject: [PATCH] updated expected output for end-to-end tests. --- examples/expected/dijkstra.py.out | 48 ++++++------- examples/expected/matrixops.py.out | 6 +- examples/expected/papa2.py.out | 106 ++++++++++++++--------------- examples/expected/simple.py.out | 6 +- src/Dyna/Backend/Python/debug.py | 4 -- 5 files changed, 83 insertions(+), 87 deletions(-) diff --git a/examples/expected/dijkstra.py.out b/examples/expected/dijkstra.py.out index 562a7a8..4fcbb54 100644 --- a/examples/expected/dijkstra.py.out +++ b/examples/expected/dijkstra.py.out @@ -3,23 +3,23 @@ Charts ============ edge/2 ================= -edge('BOS','JFK') := 187 -edge('BOS','MIA') := 1258 -edge('DFW','LAX') := 1235 -edge('DFW','ORD') := 802 -edge('FriendHouse','BOS') := 10 -edge('JFK','DFW') := 1391 -edge('JFK','MIA') := 1090 -edge('JFK','SFO') := 2582 -edge('LAX','ORD') := 1749 -edge('MIA','DFW') := 1121 -edge('MIA','LAX') := 2342 -edge('ORD','DFW') := 802 -edge('ORD','MyHouse') := 20 +edge("BOS","JFK") := 187 +edge("BOS","MIA") := 1258 +edge("DFW","LAX") := 1235 +edge("DFW","ORD") := 802 +edge("FriendHouse","BOS") := 10 +edge("JFK","DFW") := 1391 +edge("JFK","MIA") := 1090 +edge("JFK","SFO") := 2582 +edge("LAX","ORD") := 1749 +edge("MIA","DFW") := 1121 +edge("MIA","LAX") := 2342 +edge("ORD","DFW") := 802 +edge("ORD","MyHouse") := 20 end/0 ================= -end := 'MyHouse' +end := "MyHouse" goal/0 ================= @@ -27,17 +27,17 @@ goal := 2410 path/1 ================= -path('BOS') := 10 -path('DFW') := 1588 -path('FriendHouse') := 0 -path('JFK') := 197 -path('LAX') := 2823 -path('MIA') := 1268 -path('MyHouse') := 2410 -path('ORD') := 2390 -path('SFO') := 2779 +path("BOS") := 10 +path("DFW") := 1588 +path("FriendHouse") := 0 +path("JFK") := 197 +path("LAX") := 2823 +path("MIA") := 1268 +path("MyHouse") := 2410 +path("ORD") := 2390 +path("SFO") := 2779 start/0 ================= -start := 'FriendHouse' +start := "FriendHouse" diff --git a/examples/expected/matrixops.py.out b/examples/expected/matrixops.py.out index 434aef4..76ff743 100644 --- a/examples/expected/matrixops.py.out +++ b/examples/expected/matrixops.py.out @@ -50,9 +50,9 @@ rows(c) := 2 shape/3 ================= -shape(a,2,2) := True -shape(b,2,3) := True -shape(c,2,3) := True +shape(a,2,2) := true +shape(b,2,3) := true +shape(c,2,3) := true times/4 ================= diff --git a/examples/expected/papa2.py.out b/examples/expected/papa2.py.out index e616c05..3ec66f3 100644 --- a/examples/expected/papa2.py.out +++ b/examples/expected/papa2.py.out @@ -3,11 +3,11 @@ Charts ============ best/0 ================= -best := pair(1,t('S',t('S',t('NP','Papa'),t('VP',t('VP',t('V','ate'),t('NP',t('Det','the'),t('N','caviar'))),t('PP',t('P','with'),t('NP',t('Det','a'),t('N','spoon'))))),'.')) +best := pair(1,t("S",t("S",t("NP","Papa"),t("VP",t("VP",t("V","ate"),t("NP",t("Det","the"),t("N","caviar"))),t("PP",t("P","with"),t("NP",t("Det","a"),t("N","spoon"))))),".")) bestParse/0 ================= -bestParse := t('S',t('S',t('NP','Papa'),t('VP',t('VP',t('V','ate'),t('NP',t('Det','the'),t('N','caviar'))),t('PP',t('P','with'),t('NP',t('Det','a'),t('N','spoon'))))),'.') +bestParse := t("S",t("S",t("NP","Papa"),t("VP",t("VP",t("V","ate"),t("NP",t("Det","the"),t("N","caviar"))),t("PP",t("P","with"),t("NP",t("Det","a"),t("N","spoon"))))),".") bestScore/0 ================= @@ -15,8 +15,8 @@ bestScore := 1 goal/1 ================= -goal(t('S',t('S',t('NP','Papa'),t('VP',t('V','ate'),t('NP',t('NP',t('Det','the'),t('N','caviar')),t('PP',t('P','with'),t('NP',t('Det','a'),t('N','spoon')))))),'.')) := 1 -goal(t('S',t('S',t('NP','Papa'),t('VP',t('VP',t('V','ate'),t('NP',t('Det','the'),t('N','caviar'))),t('PP',t('P','with'),t('NP',t('Det','a'),t('N','spoon'))))),'.')) := 1 +goal(t("S",t("S",t("NP","Papa"),t("VP",t("V","ate"),t("NP",t("NP",t("Det","the"),t("N","caviar")),t("PP",t("P","with"),t("NP",t("Det","a"),t("N","spoon")))))),".")) := 1 +goal(t("S",t("S",t("NP","Papa"),t("VP",t("VP",t("V","ate"),t("NP",t("Det","the"),t("N","caviar"))),t("PP",t("P","with"),t("NP",t("Det","a"),t("N","spoon"))))),".")) := 1 length/0 ================= @@ -28,53 +28,53 @@ pair/2 phrase/4 ================= -phrase('.',7,8,'.') := 1 -phrase('Det',2,3,t('Det','the')) := 1 -phrase('Det',5,6,t('Det','a')) := 1 -phrase('N',3,4,t('N','caviar')) := 1 -phrase('N',6,7,t('N','spoon')) := 1 -phrase('NP',0,1,t('NP','Papa')) := 1 -phrase('NP',2,4,t('NP',t('Det','the'),t('N','caviar'))) := 1 -phrase('NP',2,7,t('NP',t('NP',t('Det','the'),t('N','caviar')),t('PP',t('P','with'),t('NP',t('Det','a'),t('N','spoon'))))) := 1 -phrase('NP',5,7,t('NP',t('Det','a'),t('N','spoon'))) := 1 -phrase('P',4,5,t('P','with')) := 1 -phrase('PP',4,7,t('PP',t('P','with'),t('NP',t('Det','a'),t('N','spoon')))) := 1 -phrase('Papa',0,1,'Papa') := 1 -phrase('S',0,4,t('S',t('NP','Papa'),t('VP',t('V','ate'),t('NP',t('Det','the'),t('N','caviar'))))) := 1 -phrase('S',0,7,t('S',t('NP','Papa'),t('VP',t('V','ate'),t('NP',t('NP',t('Det','the'),t('N','caviar')),t('PP',t('P','with'),t('NP',t('Det','a'),t('N','spoon'))))))) := 1 -phrase('S',0,7,t('S',t('NP','Papa'),t('VP',t('VP',t('V','ate'),t('NP',t('Det','the'),t('N','caviar'))),t('PP',t('P','with'),t('NP',t('Det','a'),t('N','spoon')))))) := 1 -phrase('S',0,8,t('S',t('S',t('NP','Papa'),t('VP',t('V','ate'),t('NP',t('NP',t('Det','the'),t('N','caviar')),t('PP',t('P','with'),t('NP',t('Det','a'),t('N','spoon')))))),'.')) := 1 -phrase('S',0,8,t('S',t('S',t('NP','Papa'),t('VP',t('VP',t('V','ate'),t('NP',t('Det','the'),t('N','caviar'))),t('PP',t('P','with'),t('NP',t('Det','a'),t('N','spoon'))))),'.')) := 1 -phrase('V',1,2,t('V','ate')) := 1 -phrase('VP',1,4,t('VP',t('V','ate'),t('NP',t('Det','the'),t('N','caviar')))) := 1 -phrase('VP',1,7,t('VP',t('V','ate'),t('NP',t('NP',t('Det','the'),t('N','caviar')),t('PP',t('P','with'),t('NP',t('Det','a'),t('N','spoon')))))) := 1 -phrase('VP',1,7,t('VP',t('VP',t('V','ate'),t('NP',t('Det','the'),t('N','caviar'))),t('PP',t('P','with'),t('NP',t('Det','a'),t('N','spoon'))))) := 1 -phrase('a',5,6,'a') := 1 -phrase('ate',1,2,'ate') := 1 -phrase('caviar',3,4,'caviar') := 1 -phrase('spoon',6,7,'spoon') := 1 -phrase('the',2,3,'the') := 1 -phrase('with',4,5,'with') := 1 +phrase(".",7,8,".") := 1 +phrase("Det",2,3,t("Det","the")) := 1 +phrase("Det",5,6,t("Det","a")) := 1 +phrase("N",3,4,t("N","caviar")) := 1 +phrase("N",6,7,t("N","spoon")) := 1 +phrase("NP",0,1,t("NP","Papa")) := 1 +phrase("NP",2,4,t("NP",t("Det","the"),t("N","caviar"))) := 1 +phrase("NP",2,7,t("NP",t("NP",t("Det","the"),t("N","caviar")),t("PP",t("P","with"),t("NP",t("Det","a"),t("N","spoon"))))) := 1 +phrase("NP",5,7,t("NP",t("Det","a"),t("N","spoon"))) := 1 +phrase("P",4,5,t("P","with")) := 1 +phrase("PP",4,7,t("PP",t("P","with"),t("NP",t("Det","a"),t("N","spoon")))) := 1 +phrase("Papa",0,1,"Papa") := 1 +phrase("S",0,4,t("S",t("NP","Papa"),t("VP",t("V","ate"),t("NP",t("Det","the"),t("N","caviar"))))) := 1 +phrase("S",0,7,t("S",t("NP","Papa"),t("VP",t("V","ate"),t("NP",t("NP",t("Det","the"),t("N","caviar")),t("PP",t("P","with"),t("NP",t("Det","a"),t("N","spoon"))))))) := 1 +phrase("S",0,7,t("S",t("NP","Papa"),t("VP",t("VP",t("V","ate"),t("NP",t("Det","the"),t("N","caviar"))),t("PP",t("P","with"),t("NP",t("Det","a"),t("N","spoon")))))) := 1 +phrase("S",0,8,t("S",t("S",t("NP","Papa"),t("VP",t("V","ate"),t("NP",t("NP",t("Det","the"),t("N","caviar")),t("PP",t("P","with"),t("NP",t("Det","a"),t("N","spoon")))))),".")) := 1 +phrase("S",0,8,t("S",t("S",t("NP","Papa"),t("VP",t("VP",t("V","ate"),t("NP",t("Det","the"),t("N","caviar"))),t("PP",t("P","with"),t("NP",t("Det","a"),t("N","spoon"))))),".")) := 1 +phrase("V",1,2,t("V","ate")) := 1 +phrase("VP",1,4,t("VP",t("V","ate"),t("NP",t("Det","the"),t("N","caviar")))) := 1 +phrase("VP",1,7,t("VP",t("V","ate"),t("NP",t("NP",t("Det","the"),t("N","caviar")),t("PP",t("P","with"),t("NP",t("Det","a"),t("N","spoon")))))) := 1 +phrase("VP",1,7,t("VP",t("VP",t("V","ate"),t("NP",t("Det","the"),t("N","caviar"))),t("PP",t("P","with"),t("NP",t("Det","a"),t("N","spoon"))))) := 1 +phrase("a",5,6,"a") := 1 +phrase("ate",1,2,"ate") := 1 +phrase("caviar",3,4,"caviar") := 1 +phrase("spoon",6,7,"spoon") := 1 +phrase("the",2,3,"the") := 1 +phrase("with",4,5,"with") := 1 rewrite/2 ================= -rewrite('Det','a') := 1 -rewrite('Det','the') := 1 -rewrite('N','caviar') := 1 -rewrite('N','spoon') := 1 -rewrite('NP','Papa') := 1 -rewrite('P','with') := 1 -rewrite('V','ate') := 1 +rewrite("Det","a") := 1 +rewrite("Det","the") := 1 +rewrite("N","caviar") := 1 +rewrite("N","spoon") := 1 +rewrite("NP","Papa") := 1 +rewrite("P","with") := 1 +rewrite("V","ate") := 1 rewrite/3 ================= -rewrite('NP','Det','N') := 1 -rewrite('NP','NP','PP') := 1 -rewrite('PP','P','NP') := 1 -rewrite('S','NP','VP') := 1 -rewrite('S','S','.') := 1 -rewrite('VP','V','NP') := 1 -rewrite('VP','VP','PP') := 1 +rewrite("NP","Det","N") := 1 +rewrite("NP","NP","PP") := 1 +rewrite("PP","P","NP") := 1 +rewrite("S","NP","VP") := 1 +rewrite("S","S",".") := 1 +rewrite("VP","V","NP") := 1 +rewrite("VP","VP","PP") := 1 t/2 ================= @@ -86,12 +86,12 @@ t/3 word/2 ================= -word('.',7) := True -word('Papa',0) := True -word('a',5) := True -word('ate',1) := True -word('caviar',3) := True -word('spoon',6) := True -word('the',2) := True -word('with',4) := True +word(".",7) := true +word("Papa",0) := true +word("a",5) := true +word("ate",1) := true +word("caviar",3) := true +word("spoon",6) := true +word("the",2) := true +word("with",4) := true diff --git a/examples/expected/simple.py.out b/examples/expected/simple.py.out index b8b99a9..bd2f72c 100644 --- a/examples/expected/simple.py.out +++ b/examples/expected/simple.py.out @@ -3,13 +3,13 @@ Charts ============ a/0 ================= -a := True +a := true b/0 ================= -b := True +b := true c/0 ================= -c := True +c := true diff --git a/src/Dyna/Backend/Python/debug.py b/src/Dyna/Backend/Python/debug.py index 1d69906..96f816a 100644 --- a/src/Dyna/Backend/Python/debug.py +++ b/src/Dyna/Backend/Python/debug.py @@ -146,10 +146,6 @@ class Hypergraph(object): return t(root) -#def show_slice(e, M): -# return [(b if bind else ':') for b, bind in zip(e.body, M)] - - def isvar(x): return isinstance(x,str) and (x.isupper() or x.startswith('_$')) -- 2.50.1