Fixing 'linearize' in py-bindings/test.py

This commit is contained in:
jordi.saludes
2011-12-22 21:29:45 +00:00
parent bff947f44f
commit fb0f46be4a
4 changed files with 6 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
{-# LANGUAGE ForeignFunctionInterface #-}
--
-- GF Python bindings
-- Jordi Saludes, upc.edu 2010
-- Jordi Saludes, upc.edu 2010, 2011
--
module PyGF where
@@ -157,9 +157,6 @@ listToPyStrings ss = do
pcs <- pyString cs
pyl << pcs
-- foreign export ccall "gf_freeArray" free :: Ptr a -> IO ()
foreign export ccall gf_showLanguage :: Ptr Language -> IO CString
gf_showLanguage plang = do

View File

@@ -9,7 +9,7 @@ First you must import the library:
>>> import gf
then load a .pgf file, like this tiny example:
then load a PGF file, like this tiny example:
>>> pgf = gf.read_pgf("Query.pgf")
@@ -73,7 +73,7 @@ Is it important to note the blank space at the end, otherwise we get it again:
['is']
But, how come that nothing is suggested at "is "?
At the current point, a literal integer is expected so GF would have to present an infinite list of alternatives. I can not blame it for refusing to do so.
At the current point, a literal integer is expected so GF would have to present an infinite list of alternatives. I cannot blame it for refusing to do so.
>>> pgf.complete(eng, "is 42 ")
['even', 'odd', 'prime']

View File

@@ -267,7 +267,7 @@ static PyMethodDef expr_methods[] = {
/* tree typr: methods, constructor and destructor */
/* tree type: methods, constructor and destructor */
// Are Expr and Tree equivalent ?
REPRCB(tree_repr, Tree, gf_showExpr)

View File

@@ -108,7 +108,7 @@ class TestLinearize(unittest.TestCase):
l = self.lang
for abs,cnc in self.samples:
ts = self.pgf.parse(l, cnc['eng'])
self.assertEqual(cnc['eng'],self.pgf.lin(l,ts[0]))
self.assertEqual(cnc['eng'],self.pgf.linearize(l,ts[0]))
class TestTranslate(unittest.TestCase):
def setUp(self):
@@ -123,7 +123,7 @@ class TestTranslate(unittest.TestCase):
if i==j: continue
parsed = self.pgf.parse(l, cnc[i])
assert len(parsed) == 1
lin = self.pgf.lin(m,parsed[0])
lin = self.pgf.linearize(m,parsed[0])
self.assertEqual(lin,cnc[j])
class TestUnapplyExpr(unittest.TestCase):