summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/cdec/__init__.py1
-rw-r--r--python/pkg/cdec/__init__.py1
-rw-r--r--python/pkg/cdec/configobj.py (renamed from python/cdec/configobj.py)0
-rw-r--r--python/pkg/cdec/sa/__init__.py (renamed from python/cdec/sa/__init__.py)4
-rw-r--r--python/pkg/cdec/sa/compile.py (renamed from python/cdec/sa/compile.py)0
-rw-r--r--python/pkg/cdec/sa/extract.py (renamed from python/cdec/sa/extract.py)0
-rw-r--r--python/pkg/cdec/sa/extractor.py (renamed from python/cdec/sa/extractor.py)0
-rw-r--r--python/pkg/cdec/sa/features.py (renamed from python/cdec/sa/features.py)0
-rw-r--r--python/pkg/cdec/score.py (renamed from python/cdec/score.py)0
-rw-r--r--python/setup.py3
-rw-r--r--python/src/sa/_sa.c39
-rw-r--r--python/src/sa/sym.pxi2
12 files changed, 22 insertions, 28 deletions
diff --git a/python/cdec/__init__.py b/python/cdec/__init__.py
deleted file mode 100644
index 19058493..00000000
--- a/python/cdec/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from _cdec import Decoder, Lattice, TRule, NT, NTRef, ParseFailed, InvalidConfig
diff --git a/python/pkg/cdec/__init__.py b/python/pkg/cdec/__init__.py
new file mode 100644
index 00000000..503ac787
--- /dev/null
+++ b/python/pkg/cdec/__init__.py
@@ -0,0 +1 @@
+from cdec._cdec import Decoder, Lattice, TRule, NT, NTRef, ParseFailed, InvalidConfig
diff --git a/python/cdec/configobj.py b/python/pkg/cdec/configobj.py
index c1f6e6df..c1f6e6df 100644
--- a/python/cdec/configobj.py
+++ b/python/pkg/cdec/configobj.py
diff --git a/python/cdec/sa/__init__.py b/python/pkg/cdec/sa/__init__.py
index 8645e837..fd4a4148 100644
--- a/python/cdec/sa/__init__.py
+++ b/python/pkg/cdec/sa/__init__.py
@@ -1,4 +1,4 @@
-from _sa import sym_fromstring,\
+from cdec.sa._sa import sym_fromstring,\
SuffixArray, DataArray, LCP, Precomputation, Alignment, BiLex,\
HieroCachingRuleFactory, Sampler
-from extractor import GrammarExtractor
+from cdec.sa.extractor import GrammarExtractor
diff --git a/python/cdec/sa/compile.py b/python/pkg/cdec/sa/compile.py
index 30e605a6..30e605a6 100644
--- a/python/cdec/sa/compile.py
+++ b/python/pkg/cdec/sa/compile.py
diff --git a/python/cdec/sa/extract.py b/python/pkg/cdec/sa/extract.py
index 918aa3bb..918aa3bb 100644
--- a/python/cdec/sa/extract.py
+++ b/python/pkg/cdec/sa/extract.py
diff --git a/python/cdec/sa/extractor.py b/python/pkg/cdec/sa/extractor.py
index bb912e16..bb912e16 100644
--- a/python/cdec/sa/extractor.py
+++ b/python/pkg/cdec/sa/extractor.py
diff --git a/python/cdec/sa/features.py b/python/pkg/cdec/sa/features.py
index 325b9e13..325b9e13 100644
--- a/python/cdec/sa/features.py
+++ b/python/pkg/cdec/sa/features.py
diff --git a/python/cdec/score.py b/python/pkg/cdec/score.py
index 22257774..22257774 100644
--- a/python/cdec/score.py
+++ b/python/pkg/cdec/score.py
diff --git a/python/setup.py b/python/setup.py
index 1d1d7e45..7be976e8 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -48,5 +48,6 @@ setup(
name='cdec',
ext_modules=ext_modules,
requires=['configobj'],
- packages=['cdec', 'cdec.sa']
+ packages=['cdec', 'cdec.sa'],
+ package_dir={'': 'pkg'}
)
diff --git a/python/src/sa/_sa.c b/python/src/sa/_sa.c
index 34f170bf..b7f3627a 100644
--- a/python/src/sa/_sa.c
+++ b/python/src/sa/_sa.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.17.beta1 on Fri Jul 27 22:15:31 2012 */
+/* Generated by Cython 0.17.beta1 on Fri Jul 27 23:31:04 2012 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -2013,7 +2013,7 @@ static int __pyx_pf_3_sa_8Alphabet___cinit__(struct __pyx_obj_3_sa_Alphabet *__p
static void __pyx_pf_3_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3_sa_8Alphabet_9terminals___get__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_3_sa_2sym_fromstring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, int __pyx_v_terminal); /* proto */
+static PyObject *__pyx_pf_3_sa_2sym_fromstring(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_string, int __pyx_v_terminal); /* proto */
static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_words); /* proto */
static void __pyx_pf_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3_sa_6Phrase_4__str__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self); /* proto */
@@ -21750,7 +21750,7 @@ static int __pyx_f_3_sa_sym_setindex(int __pyx_v_sym, int __pyx_v_id) {
* cdef int sym_setindex(int sym, int id):
* return ALPHABET.setindex(sym, id) # <<<<<<<<<<<<<<
*
- * def sym_fromstring(bytes string, bint terminal):
+ * def sym_fromstring(char* string, bint terminal):
*/
__pyx_r = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->setindex(__pyx_v_3_sa_ALPHABET, __pyx_v_sym, __pyx_v_id);
goto __pyx_L0;
@@ -21765,7 +21765,7 @@ static int __pyx_f_3_sa_sym_setindex(int __pyx_v_sym, int __pyx_v_id) {
static PyObject *__pyx_pw_3_sa_3sym_fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_3_sa_3sym_fromstring = {__Pyx_NAMESTR("sym_fromstring"), (PyCFunction)__pyx_pw_3_sa_3sym_fromstring, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_3_sa_3sym_fromstring(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- PyObject *__pyx_v_string = 0;
+ char *__pyx_v_string;
int __pyx_v_terminal;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -21802,7 +21802,7 @@ static PyObject *__pyx_pw_3_sa_3sym_fromstring(PyObject *__pyx_self, PyObject *_
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
- __pyx_v_string = ((PyObject*)values[0]);
+ __pyx_v_string = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_string) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_terminal = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_terminal == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
@@ -21813,12 +21813,7 @@ static PyObject *__pyx_pw_3_sa_3sym_fromstring(PyObject *__pyx_self, PyObject *_
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_string), (&PyBytes_Type), 1, "string", 1))) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_3_sa_2sym_fromstring(__pyx_self, __pyx_v_string, __pyx_v_terminal);
- goto __pyx_L0;
- __pyx_L1_error:;
- __pyx_r = NULL;
- __pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -21826,15 +21821,14 @@ static PyObject *__pyx_pw_3_sa_3sym_fromstring(PyObject *__pyx_self, PyObject *_
/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":104
* return ALPHABET.setindex(sym, id)
*
- * def sym_fromstring(bytes string, bint terminal): # <<<<<<<<<<<<<<
+ * def sym_fromstring(char* string, bint terminal): # <<<<<<<<<<<<<<
* return ALPHABET.fromstring(string, terminal)
*/
-static PyObject *__pyx_pf_3_sa_2sym_fromstring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, int __pyx_v_terminal) {
+static PyObject *__pyx_pf_3_sa_2sym_fromstring(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_string, int __pyx_v_terminal) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
- char *__pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -21842,21 +21836,20 @@ static PyObject *__pyx_pf_3_sa_2sym_fromstring(CYTHON_UNUSED PyObject *__pyx_sel
/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":105
*
- * def sym_fromstring(bytes string, bint terminal):
+ * def sym_fromstring(char* string, bint terminal):
* return ALPHABET.fromstring(string, terminal) # <<<<<<<<<<<<<<
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_string)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->fromstring(__pyx_v_3_sa_ALPHABET, __pyx_t_1, __pyx_v_terminal)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->fromstring(__pyx_v_3_sa_ALPHABET, __pyx_v_string, __pyx_v_terminal)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("_sa.sym_fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -60511,7 +60504,7 @@ static int __Pyx_InitCachedConstants(void) {
/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":104
* return ALPHABET.setindex(sym, id)
*
- * def sym_fromstring(bytes string, bint terminal): # <<<<<<<<<<<<<<
+ * def sym_fromstring(char* string, bint terminal): # <<<<<<<<<<<<<<
* return ALPHABET.fromstring(string, terminal)
*/
__pyx_k_tuple_137 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_137)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -60933,7 +60926,7 @@ PyMODINIT_FUNC PyInit__sa(void)
/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":104
* return ALPHABET.setindex(sym, id)
*
- * def sym_fromstring(bytes string, bint terminal): # <<<<<<<<<<<<<<
+ * def sym_fromstring(char* string, bint terminal): # <<<<<<<<<<<<<<
* return ALPHABET.fromstring(string, terminal)
*/
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_3sym_fromstring, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
diff --git a/python/src/sa/sym.pxi b/python/src/sa/sym.pxi
index 4b41886f..132925f6 100644
--- a/python/src/sa/sym.pxi
+++ b/python/src/sa/sym.pxi
@@ -101,5 +101,5 @@ cdef int sym_getindex(int sym):
cdef int sym_setindex(int sym, int id):
return ALPHABET.setindex(sym, id)
-def sym_fromstring(bytes string, bint terminal):
+def sym_fromstring(char* string, bint terminal):
return ALPHABET.fromstring(string, terminal)