]> hydra-www.ietfng.org Git - dyna2/commitdiff
tweaks.
authortimv <tim.f.vieira@gmail.com>
Thu, 13 Dec 2012 04:10:44 +0000 (23:10 -0500)
committertimv <tim.f.vieira@gmail.com>
Thu, 13 Dec 2012 04:10:44 +0000 (23:10 -0500)
bin/defn.py
bin/stdlib.py
examples/papa2.dyna

index 89eed96027610066a98b38ffabd01db2a683c81b..48bb3b84a6341e48f2c29fdd1d1fec0de68bec25 100644 (file)
@@ -92,6 +92,7 @@ def agg_bind(agg_decl, table):
         '*=': times_equals,
         '&=': and_equals,
         '|=': or_equals,
+        ':-': or_equals,
     }
 
     # commit functors to an aggregator definition to avoid unnecessary lookups.
index a72275e3b4633909182b5611952e7b9ee26ff2b3..4c714b9e42c6538e52f441dbdf0c1a828045ab3a 100644 (file)
@@ -352,9 +352,12 @@ class UserChart(object):
 
 #constructor_names = {''.join(functor.split('/')[:-1]) for functor in chart}
 for _fn in chart:
-    exec '%s = UserChart(chart[%r])' % (_fn.replace('/', ''), _fn)
+    try:
+        exec '%s = UserChart(chart[%r])' % (_fn.replace('/', ''), _fn)
+    except:
+        pass
 
 #def phrase(A,I,K):
 #    return chart['phrase/3']
 
-from debug import ip; ip()
+from IPython import embed; embed()
index 42a4bfbf0f7bb3bbd892965e4b508d80afa2eab4..a9c81405f6741c6a989d759cd8b5df7d23588331 100644 (file)
@@ -1,8 +1,8 @@
 % Parsing a simple sentence.
 
 % CKY-like parsing
-phrase(X,I,K,t(X,TY)) += phrase(Y,I,K,TY) * rewrite(X,Y).
-phrase(X,I,K,t(X,TY,TZ)) += phrase(Y,I,J,TY) * phrase(Z,J,K,TZ) * rewrite(X,Y,Z).
+phrase(X,I,K,t(X,TY)) max= phrase(Y,I,K,TY) * rewrite(X,Y).
+phrase(X,I,K,t(X,TY,TZ)) max= phrase(Y,I,J,TY) * phrase(Z,J,K,TZ) * rewrite(X,Y,Z).
 
 goal(P) += phrase("S", 0, *length, P).
 
@@ -27,15 +27,15 @@ rewrite("Det",      "a") += 1.
 
 % sentence
 % "Papa at the caviar with the spoon ."
-word(  "Papa", 0) += 1.
-word(   "ate", 1) += 1.
-word(   "the", 2) += 1.
-word("caviar", 3) += 1.
-word(  "with", 4) += 1.
-word(     "a", 5) += 1.
-word( "spoon", 6) += 1.
-word(     ".", 7) += 1.
+word(  "Papa", 0).
+word(   "ate", 1).
+word(   "the", 2).
+word("caviar", 3).
+word(  "with", 4).
+word(     "a", 5).
+word( "spoon", 6).
+word(     ".", 7).
 
 % for fun, try making the above words facts instead of +=1's.
 
-phrase(W, I, I+1, W) += (word(W, I) > 0) & 1.
+phrase(W, I, I+1, W) max= (word(W, I) > 0) & 1.