From 1e44fdb3d3413709ae635f0fae91ffa4a93a2d9d Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Fri, 16 Aug 2013 12:44:37 +0000 Subject: fixes in the C and Python API to make them closer to the Haskell API --- src/runtime/python/pypgf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/runtime/python') diff --git a/src/runtime/python/pypgf.c b/src/runtime/python/pypgf.c index e2fc0234e..d54dd14ad 100644 --- a/src/runtime/python/pypgf.c +++ b/src/runtime/python/pypgf.c @@ -1228,7 +1228,7 @@ Concr_parse(ConcrObject* self, PyObject *args, PyObject *keywds) } static IterObject* -Concr_getCompletions(ConcrObject* self, PyObject *args, PyObject *keywds) +Concr_complete(ConcrObject* self, PyObject *args, PyObject *keywds) { static char *kwlist[] = {"sentence", "tokens", "cat", "prefix", "n", NULL}; @@ -1295,7 +1295,7 @@ Concr_getCompletions(ConcrObject* self, PyObject *args, PyObject *keywds) } pyres->res = - pgf_get_completions(self->concr, catname, lexer, prefix, pyres->pool); + pgf_complete(self->concr, catname, lexer, prefix, pyres->pool); if (pyres->res == NULL) { Py_DECREF(pyres); @@ -1698,7 +1698,7 @@ static PyMethodDef Concr_methods[] = { "- n (int), max. trees; OPTIONAL, default: extract all trees\n" "- heuristics (double >= 0.0); OPTIONAL, default: taken from the flags in the grammar" }, - {"getCompletions", (PyCFunction)Concr_getCompletions, METH_VARARGS | METH_KEYWORDS, + {"complete", (PyCFunction)Concr_complete, METH_VARARGS | METH_KEYWORDS, "Parses a partial string and returns a list with the top n possible next tokens" }, {"parseval", (PyCFunction)Concr_parseval, METH_VARARGS, @@ -2011,7 +2011,7 @@ PGF_functionType(PGFObject* self, PyObject *args) } static IterObject* -PGF_generate(PGFObject* self, PyObject *args, PyObject *keywds) +PGF_generateAll(PGFObject* self, PyObject *args, PyObject *keywds) { static char *kwlist[] = {"cat", "n", NULL}; @@ -2040,7 +2040,7 @@ PGF_generate(PGFObject* self, PyObject *args, PyObject *keywds) GuString catname = gu_str_string(catname_s, tmp_pool); pyres->res = - pgf_generate(self->pgf, catname, pyres->pool); + pgf_generate_all(self->pgf, catname, pyres->pool); if (pyres->res == NULL) { Py_DECREF(pyres); gu_pool_free(tmp_pool); @@ -2122,7 +2122,7 @@ static PyMethodDef PGF_methods[] = { {"functionType", (PyCFunction)PGF_functionType, METH_VARARGS, "Returns the type of a function" }, - {"generate", (PyCFunction)PGF_generate, METH_VARARGS | METH_KEYWORDS, + {"generateAll", (PyCFunction)PGF_generateAll, METH_VARARGS | METH_KEYWORDS, "Generates abstract syntax trees of given category in decreasing probability order" }, {"compute", (PyCFunction)PGF_compute, METH_VARARGS, -- cgit v1.2.3