summaryrefslogtreecommitdiff
path: root/python/cdec/sa
diff options
context:
space:
mode:
Diffstat (limited to 'python/cdec/sa')
-rw-r--r--python/cdec/sa/__init__.py1
-rw-r--r--python/cdec/sa/_sa.cpp1487
-rw-r--r--python/cdec/sa/compile.py17
-rw-r--r--python/cdec/sa/extract.py8
-rw-r--r--python/cdec/sa/extractor.py8
-rw-r--r--python/cdec/sa/features.py6
-rw-r--r--python/cdec/sa/online.py95
-rw-r--r--python/cdec/sa/rulefactory.pxi9
8 files changed, 902 insertions, 729 deletions
diff --git a/python/cdec/sa/__init__.py b/python/cdec/sa/__init__.py
index 14ba5ecb..0c132cb9 100644
--- a/python/cdec/sa/__init__.py
+++ b/python/cdec/sa/__init__.py
@@ -3,6 +3,7 @@ from cdec.sa._sa import make_lattice, decode_lattice, decode_sentence,\
SuffixArray, DataArray, LCP, Precomputation, Alignment, BiLex,\
HieroCachingRuleFactory, Sampler, Scorer
from cdec.sa.extractor import GrammarExtractor
+import online
_SA_FEATURES = []
_SA_ANNOTATORS = {}
diff --git a/python/cdec/sa/_sa.cpp b/python/cdec/sa/_sa.cpp
index c59fa22b..6e8b0a6f 100644
--- a/python/cdec/sa/_sa.cpp
+++ b/python/cdec/sa/_sa.cpp
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.19.2 on Mon Mar 3 08:00:58 2014 */
+/* Generated by Cython 0.19.2 on Thu Mar 6 14:00:22 2014 */
#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
@@ -710,7 +710,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice {
};
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2144
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2149
*
* # Rule string from rule
* def fmt_rule(self, f, e, a): # <<<<<<<<<<<<<<
@@ -863,7 +863,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr {
};
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2163
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2168
* # (Used for EGivenFCoherent)
* # Return set of (fphrase, lex_i, lex_j)
* def get_f_phrases(self, f_words): # <<<<<<<<<<<<<<
@@ -1019,7 +1019,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words {
};
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2140
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2145
* f = Phrase(f_sym)
* e = Phrase(e_sym)
* a = tuple(self.alignment.link(i, j) for i, j in links) # <<<<<<<<<<<<<<
@@ -1281,7 +1281,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words {
};
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2145
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2150
* # Rule string from rule
* def fmt_rule(self, f, e, a):
* a_str = ' '.join('{0}-{1}'.format(*self.alignment.unlink(packed)) for packed in a) # <<<<<<<<<<<<<<
@@ -1332,7 +1332,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr {
};
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2079
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2084
*
* # Create a rule from source, target, non-terminals, and alignments
* def form_rule(self, f_i, e_i, f_span, e_span, nt, al): # <<<<<<<<<<<<<<
@@ -61846,6 +61846,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
PyObject *__pyx_v_e_ph = NULL;
PyObject *__pyx_v_aligned_fe = NULL;
PyObject *__pyx_v_aligned_ef = NULL;
+ int __pyx_v_null_word;
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_j = NULL;
PyObject *__pyx_v_e_i_aligned = NULL;
@@ -61871,6 +61872,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
Py_ssize_t __pyx_t_14;
PyObject *(*__pyx_t_15)(PyObject *);
PyObject *__pyx_t_16 = NULL;
+ int __pyx_t_17;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -62925,7 +62927,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
* # Update Bilexical counts
* aligned_fe = [list() for _ in range(len(f_words))] # <<<<<<<<<<<<<<
* aligned_ef = [list() for _ in range(len(e_words))]
- * for (i, j) in alignment:
+ * null_word = sym_fromstring('NULL', True)
*/
__pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
@@ -62993,8 +62995,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
* # Update Bilexical counts
* aligned_fe = [list() for _ in range(len(f_words))]
* aligned_ef = [list() for _ in range(len(e_words))] # <<<<<<<<<<<<<<
+ * null_word = sym_fromstring('NULL', True)
* for (i, j) in alignment:
- * aligned_fe[i].append(j)
*/
__pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
@@ -63061,6 +63063,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2060
* aligned_fe = [list() for _ in range(len(f_words))]
* aligned_ef = [list() for _ in range(len(e_words))]
+ * null_word = sym_fromstring('NULL', True) # <<<<<<<<<<<<<<
+ * for (i, j) in alignment:
+ * aligned_fe[i].append(j)
+ */
+ __pyx_v_null_word = __pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_k__NULL, 1);
+
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2061
+ * aligned_ef = [list() for _ in range(len(e_words))]
+ * null_word = sym_fromstring('NULL', True)
* for (i, j) in alignment: # <<<<<<<<<<<<<<
* aligned_fe[i].append(j)
* aligned_ef[j].append(i)
@@ -63069,7 +63080,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__pyx_t_4 = __pyx_v_alignment; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_alignment); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_alignment); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
}
@@ -63077,23 +63088,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_4)) {
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_4)) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_3 = __pyx_t_5(__pyx_t_4);
if (unlikely(!__pyx_t_3)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -63109,7 +63120,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
@@ -63122,16 +63133,16 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_INCREF(__pyx_t_6);
__Pyx_INCREF(__pyx_t_1);
#else
- __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
#endif
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else
{
Py_ssize_t index = -1;
- __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
@@ -63139,7 +63150,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_GOTREF(__pyx_t_6);
index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L31_unpacking_failed;
__Pyx_GOTREF(__pyx_t_1);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L32_unpacking_done;
@@ -63147,7 +63158,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L32_unpacking_done:;
}
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6);
@@ -63155,62 +63166,62 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2061
- * aligned_ef = [list() for _ in range(len(e_words))]
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2062
+ * null_word = sym_fromstring('NULL', True)
* for (i, j) in alignment:
* aligned_fe[i].append(j) # <<<<<<<<<<<<<<
* aligned_ef[j].append(i)
* for f_i in range(len(f_words)):
*/
- __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_aligned_fe), __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_aligned_fe), __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2062
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2063
* for (i, j) in alignment:
* aligned_fe[i].append(j)
* aligned_ef[j].append(i) # <<<<<<<<<<<<<<
* for f_i in range(len(f_words)):
- * e_i_aligned = aligned_fe[f_i]
+ * stats.bilex_f[f_words[f_i]] += 1
*/
- __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_aligned_ef), __pyx_v_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_aligned_ef), __pyx_v_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2063
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2064
* aligned_fe[i].append(j)
* aligned_ef[j].append(i)
* for f_i in range(len(f_words)): # <<<<<<<<<<<<<<
+ * stats.bilex_f[f_words[f_i]] += 1
* e_i_aligned = aligned_fe[f_i]
- * lc = len(e_i_aligned)
*/
__pyx_t_4 = __pyx_cur_scope->__pyx_v_f_words;
__Pyx_INCREF(__pyx_t_4);
- __pyx_t_2 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
__pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
@@ -63219,23 +63230,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_4 = __pyx_t_5(__pyx_t_3);
if (unlikely(!__pyx_t_4)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -63244,76 +63255,76 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_XDECREF_SET(__pyx_v_f_i, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2064
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2065
* aligned_ef[j].append(i)
* for f_i in range(len(f_words)):
+ * stats.bilex_f[f_words[f_i]] += 1 # <<<<<<<<<<<<<<
+ * e_i_aligned = aligned_fe[f_i]
+ * lc = len(e_i_aligned)
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_f); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = PyObject_GetItem(__pyx_t_4, __pyx_t_1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (PyObject_SetItem(__pyx_t_4, __pyx_t_1, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2066
+ * for f_i in range(len(f_words)):
+ * stats.bilex_f[f_words[f_i]] += 1
* e_i_aligned = aligned_fe[f_i] # <<<<<<<<<<<<<<
* lc = len(e_i_aligned)
* if lc > 0:
*/
- __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_aligned_fe), __pyx_v_f_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_aligned_fe), __pyx_v_f_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_XDECREF_SET(__pyx_v_e_i_aligned, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2065
- * for f_i in range(len(f_words)):
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2067
+ * stats.bilex_f[f_words[f_i]] += 1
* e_i_aligned = aligned_fe[f_i]
* lc = len(e_i_aligned) # <<<<<<<<<<<<<<
* if lc > 0:
- * stats.bilex_f[f_words[f_i]] += 1
+ * for e_i in e_i_aligned:
*/
- __pyx_t_14 = PyObject_Length(__pyx_v_e_i_aligned); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = PyObject_Length(__pyx_v_e_i_aligned); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_XDECREF_SET(__pyx_v_lc, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2066
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2068
* e_i_aligned = aligned_fe[f_i]
* lc = len(e_i_aligned)
* if lc > 0: # <<<<<<<<<<<<<<
- * stats.bilex_f[f_words[f_i]] += 1
* for e_i in e_i_aligned:
+ * stats.bilex_fe[f_words[f_i]][e_words[e_i]] += (1.0) / lc
*/
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_lc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_RichCompare(__pyx_v_lc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_9) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2067
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2069
* lc = len(e_i_aligned)
* if lc > 0:
- * stats.bilex_f[f_words[f_i]] += 1 # <<<<<<<<<<<<<<
- * for e_i in e_i_aligned:
- * stats.bilex_fe[f_words[f_i]][e_words[e_i]] += (1.0) / lc
- */
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_f); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = PyObject_GetItem(__pyx_t_4, __pyx_t_1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (PyObject_SetItem(__pyx_t_4, __pyx_t_1, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2068
- * if lc > 0:
- * stats.bilex_f[f_words[f_i]] += 1
* for e_i in e_i_aligned: # <<<<<<<<<<<<<<
* stats.bilex_fe[f_words[f_i]][e_words[e_i]] += (1.0) / lc
- * for e_i in range(len(e_words)):
+ * else:
*/
if (PyList_CheckExact(__pyx_v_e_i_aligned) || PyTuple_CheckExact(__pyx_v_e_i_aligned)) {
__pyx_t_4 = __pyx_v_e_i_aligned; __Pyx_INCREF(__pyx_t_4); __pyx_t_14 = 0;
__pyx_t_15 = NULL;
} else {
- __pyx_t_14 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_e_i_aligned); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_e_i_aligned); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_15 = Py_TYPE(__pyx_t_4)->tp_iternext;
}
@@ -63321,23 +63332,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_4)) {
if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_4)) {
if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_1 = __pyx_t_15(__pyx_t_4);
if (unlikely(!__pyx_t_1)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -63346,35 +63357,35 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_XDECREF_SET(__pyx_v_e_i, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2069
- * stats.bilex_f[f_words[f_i]] += 1
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2070
+ * if lc > 0:
* for e_i in e_i_aligned:
* stats.bilex_fe[f_words[f_i]][e_words[e_i]] += (1.0) / lc # <<<<<<<<<<<<<<
- * for e_i in range(len(e_words)):
- * f_i_aligned = aligned_ef[e_i]
+ * else:
+ * stats.bilex_fe[f_words[f_i]][null_word] += 1
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_fe); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_fe); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_7 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_i); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_i); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_6 = PyObject_GetItem(__pyx_t_1, __pyx_t_7); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_GetItem(__pyx_t_1, __pyx_t_7); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_e_words, __pyx_v_e_i); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_e_words, __pyx_v_e_i); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_1 = PyObject_GetItem(__pyx_t_6, __pyx_t_7); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetItem(__pyx_t_6, __pyx_t_7); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_13 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- __pyx_t_16 = __Pyx_PyNumber_Divide(__pyx_t_13, __pyx_v_lc); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_16 = __Pyx_PyNumber_Divide(__pyx_t_13, __pyx_v_lc); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_16);
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- __pyx_t_13 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_16); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_16); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- if (PyObject_SetItem(__pyx_t_6, __pyx_t_7, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetItem(__pyx_t_6, __pyx_t_7, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
@@ -63382,61 +63393,88 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L35;
}
+ /*else*/ {
+
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2072
+ * stats.bilex_fe[f_words[f_i]][e_words[e_i]] += (1.0) / lc
+ * else:
+ * stats.bilex_fe[f_words[f_i]][null_word] += 1 # <<<<<<<<<<<<<<
+ * for e_i in range(len(e_words)):
+ * stats.bilex_e[e_words[e_i]] += 1
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_fe); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_i); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = PyObject_GetItem(__pyx_t_4, __pyx_t_6); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_17 = __pyx_v_null_word;
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_7, __pyx_t_17, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (__Pyx_SetItemInt(__pyx_t_7, __pyx_t_17, __pyx_t_4, sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
__pyx_L35:;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2070
- * for e_i in e_i_aligned:
- * stats.bilex_fe[f_words[f_i]][e_words[e_i]] += (1.0) / lc
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2073
+ * else:
+ * stats.bilex_fe[f_words[f_i]][null_word] += 1
* for e_i in range(len(e_words)): # <<<<<<<<<<<<<<
+ * stats.bilex_e[e_words[e_i]] += 1
* f_i_aligned = aligned_ef[e_i]
- * lc = len(f_i_aligned)
*/
__pyx_t_3 = __pyx_cur_scope->__pyx_v_e_words;
__Pyx_INCREF(__pyx_t_3);
- __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
- __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
+ __pyx_t_7 = __pyx_t_3; __Pyx_INCREF(__pyx_t_7); __pyx_t_2 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
+ __pyx_t_2 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_5 = Py_TYPE(__pyx_t_7)->tp_iternext;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_4)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_7)) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_7)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_7, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_4)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_7)) {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_7, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_3 = __pyx_t_5(__pyx_t_4);
+ __pyx_t_3 = __pyx_t_5(__pyx_t_7);
if (unlikely(!__pyx_t_3)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -63445,76 +63483,76 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_XDECREF_SET(__pyx_v_e_i, __pyx_t_3);
__pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2071
- * stats.bilex_fe[f_words[f_i]][e_words[e_i]] += (1.0) / lc
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2074
+ * stats.bilex_fe[f_words[f_i]][null_word] += 1
* for e_i in range(len(e_words)):
+ * stats.bilex_e[e_words[e_i]] += 1 # <<<<<<<<<<<<<<
+ * f_i_aligned = aligned_ef[e_i]
+ * lc = len(f_i_aligned)
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_e); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_e_words, __pyx_v_e_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_t_4); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_13 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (PyObject_SetItem(__pyx_t_3, __pyx_t_4, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2075
+ * for e_i in range(len(e_words)):
+ * stats.bilex_e[e_words[e_i]] += 1
* f_i_aligned = aligned_ef[e_i] # <<<<<<<<<<<<<<
* lc = len(f_i_aligned)
* if lc > 0:
*/
- __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_aligned_ef), __pyx_v_e_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_aligned_ef), __pyx_v_e_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_XDECREF_SET(__pyx_v_f_i_aligned, __pyx_t_3);
__pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2072
- * for e_i in range(len(e_words)):
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2076
+ * stats.bilex_e[e_words[e_i]] += 1
* f_i_aligned = aligned_ef[e_i]
* lc = len(f_i_aligned) # <<<<<<<<<<<<<<
* if lc > 0:
- * stats.bilex_e[e_words[e_i]] += 1
+ * for f_i in f_i_aligned:
*/
- __pyx_t_14 = PyObject_Length(__pyx_v_f_i_aligned); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = PyObject_Length(__pyx_v_f_i_aligned); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_XDECREF_SET(__pyx_v_lc, __pyx_t_3);
__pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2073
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2077
* f_i_aligned = aligned_ef[e_i]
* lc = len(f_i_aligned)
* if lc > 0: # <<<<<<<<<<<<<<
- * stats.bilex_e[e_words[e_i]] += 1
* for f_i in f_i_aligned:
+ * stats.bilex_ef[e_words[e_i]][f_words[f_i]] += (1.0) / lc
*/
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_lc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_lc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_9) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2074
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2078
* lc = len(f_i_aligned)
* if lc > 0:
- * stats.bilex_e[e_words[e_i]] += 1 # <<<<<<<<<<<<<<
- * for f_i in f_i_aligned:
- * stats.bilex_ef[e_words[e_i]][f_words[f_i]] += (1.0) / lc
- */
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_e); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_e_words, __pyx_v_e_i); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_t_6); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_13 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_13);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- if (PyObject_SetItem(__pyx_t_3, __pyx_t_6, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2075
- * if lc > 0:
- * stats.bilex_e[e_words[e_i]] += 1
* for f_i in f_i_aligned: # <<<<<<<<<<<<<<
* stats.bilex_ef[e_words[e_i]][f_words[f_i]] += (1.0) / lc
- *
+ * else:
*/
if (PyList_CheckExact(__pyx_v_f_i_aligned) || PyTuple_CheckExact(__pyx_v_f_i_aligned)) {
__pyx_t_3 = __pyx_v_f_i_aligned; __Pyx_INCREF(__pyx_t_3); __pyx_t_14 = 0;
__pyx_t_15 = NULL;
} else {
- __pyx_t_14 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_f_i_aligned); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_f_i_aligned); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_15 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
@@ -63522,70 +63560,97 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_3)) {
if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_6); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_4); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_3)) {
if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_6); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_4); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_6 = __pyx_t_15(__pyx_t_3);
- if (unlikely(!__pyx_t_6)) {
+ __pyx_t_4 = __pyx_t_15(__pyx_t_3);
+ if (unlikely(!__pyx_t_4)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_4);
}
- __Pyx_XDECREF_SET(__pyx_v_f_i, __pyx_t_6);
- __pyx_t_6 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_f_i, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2076
- * stats.bilex_e[e_words[e_i]] += 1
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2079
+ * if lc > 0:
* for f_i in f_i_aligned:
* stats.bilex_ef[e_words[e_i]][f_words[f_i]] += (1.0) / lc # <<<<<<<<<<<<<<
- *
- * # Create a rule from source, target, non-terminals, and alignments
+ * else:
+ * stats.bilex_ef[e_words[e_i]][null_word] += 1
*/
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_ef); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_13 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_e_words, __pyx_v_e_i); if (!__pyx_t_13) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_ef); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_13 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_e_words, __pyx_v_e_i); if (!__pyx_t_13) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- __pyx_t_7 = PyObject_GetItem(__pyx_t_6, __pyx_t_13); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = PyObject_GetItem(__pyx_t_4, __pyx_t_13); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- __pyx_t_13 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_i); if (!__pyx_t_13) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_i); if (!__pyx_t_13) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- __pyx_t_6 = PyObject_GetItem(__pyx_t_7, __pyx_t_13); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_16 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetItem(__pyx_t_6, __pyx_t_13); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_16 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_16);
- __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_16, __pyx_v_lc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_16, __pyx_v_lc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- __pyx_t_16 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_16 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_16);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetItem(__pyx_t_7, __pyx_t_13, __pyx_t_16) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetItem(__pyx_t_6, __pyx_t_13, __pyx_t_16) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L40;
}
+ /*else*/ {
+
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2081
+ * stats.bilex_ef[e_words[e_i]][f_words[f_i]] += (1.0) / lc
+ * else:
+ * stats.bilex_ef[e_words[e_i]][null_word] += 1 # <<<<<<<<<<<<<<
+ *
+ * # Create a rule from source, target, non-terminals, and alignments
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_ef); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_e_words, __pyx_v_e_i); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_13 = PyObject_GetItem(__pyx_t_3, __pyx_t_6); if (!__pyx_t_13) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_17 = __pyx_v_null_word;
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_13, __pyx_t_17, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (__Pyx_SetItemInt(__pyx_t_13, __pyx_t_17, __pyx_t_3, sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ }
__pyx_L40:;
}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
@@ -63665,31 +63730,31 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule(P
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e_i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f_span)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e_span)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nt)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 5:
if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__al)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "form_rule") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "form_rule") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
goto __pyx_L5_argtuple_error;
@@ -63710,7 +63775,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule(P
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -63753,11 +63818,11 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_la
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("lambda8", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lambda8", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda8") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda8") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
@@ -63770,7 +63835,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_la
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("lambda8", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lambda8", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda8", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -63781,7 +63846,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_la
return __pyx_r;
}
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2082
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2087
*
* # Substitute in non-terminals
* nt_inv = sorted(nt, cmp=lambda x, y: cmp(x[3], y[3])) # <<<<<<<<<<<<<<
@@ -63800,11 +63865,11 @@ static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lambda8", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -63812,7 +63877,7 @@ static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
@@ -63865,11 +63930,11 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1l
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("lambda9", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lambda9", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda9") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda9") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
@@ -63882,7 +63947,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1l
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("lambda9", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lambda9", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda9", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -63893,7 +63958,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1l
return __pyx_r;
}
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2106
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2111
* # Adjusting alignment links takes some doing
* links = [list(link) for sub in al for link in sub]
* links_inv = sorted(links, cmp=lambda x, y: cmp(x[1], y[1])) # <<<<<<<<<<<<<<
@@ -63912,11 +63977,11 @@ static PyObject *__pyx_lambda_funcdef_lambda9(CYTHON_UNUSED PyObject *__pyx_self
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lambda9", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -63924,7 +63989,7 @@ static PyObject *__pyx_lambda_funcdef_lambda9(CYTHON_UNUSED PyObject *__pyx_self
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
@@ -63946,7 +64011,7 @@ static PyObject *__pyx_lambda_funcdef_lambda9(CYTHON_UNUSED PyObject *__pyx_self
}
static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2140
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2145
* f = Phrase(f_sym)
* e = Phrase(e_sym)
* a = tuple(self.alignment.link(i, j) for i, j in links) # <<<<<<<<<<<<<<
@@ -63972,7 +64037,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_2g
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -64016,19 +64081,19 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_links)) { __Pyx_RaiseClosureNameError("links"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_links)) { __Pyx_RaiseClosureNameError("links"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_links) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_links); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
for (;;) {
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
PyObject* sequence = __pyx_t_3;
@@ -64040,7 +64105,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
@@ -64053,16 +64118,16 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(__pyx_t_5);
#else
- __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
#endif
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else
{
Py_ssize_t index = -1;
- __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
@@ -64070,7 +64135,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
__Pyx_GOTREF(__pyx_t_4);
index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_5);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_7 = NULL;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L7_unpacking_done;
@@ -64078,7 +64143,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
@@ -64089,10 +64154,10 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_j, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyInt_FromLong(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->alignment->__pyx_vtab)->link(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->alignment, __pyx_t_8, __pyx_t_9)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyInt_FromLong(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->alignment->__pyx_vtab)->link(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->alignment, __pyx_t_8, __pyx_t_9)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -64109,7 +64174,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
__pyx_cur_scope->__pyx_t_0 = 0;
__Pyx_XGOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
PyErr_SetNone(PyExc_StopIteration);
@@ -64129,7 +64194,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
return NULL;
}
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2079
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2084
*
* # Create a rule from source, target, non-terminals, and alignments
* def form_rule(self, f_i, e_i, f_span, e_span, nt, al): # <<<<<<<<<<<<<<
@@ -64186,52 +64251,52 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2082
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2087
*
* # Substitute in non-terminals
* nt_inv = sorted(nt, cmp=lambda x, y: cmp(x[3], y[3])) # <<<<<<<<<<<<<<
* f_sym = list(f_span[:])
* off = f_i
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_nt);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_nt);
__Pyx_GIVEREF(__pyx_v_nt);
- __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda8, 0, __pyx_n_s_147, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda8, 0, __pyx_n_s_147, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__cmp), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__cmp), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_v_nt_inv = __pyx_t_3;
__pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2083
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2088
* # Substitute in non-terminals
* nt_inv = sorted(nt, cmp=lambda x, y: cmp(x[3], y[3]))
* f_sym = list(f_span[:]) # <<<<<<<<<<<<<<
* off = f_i
* for next_nt in nt:
*/
- __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_f_span, 0, 0, NULL, NULL, &__pyx_k_slice_148, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_f_span, 0, 0, NULL, NULL, &__pyx_k_slice_148, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_v_f_sym = ((PyObject*)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2084
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2089
* nt_inv = sorted(nt, cmp=lambda x, y: cmp(x[3], y[3]))
* f_sym = list(f_span[:])
* off = f_i # <<<<<<<<<<<<<<
@@ -64241,7 +64306,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_v_f_i);
__pyx_v_off = __pyx_v_f_i;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2085
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2090
* f_sym = list(f_span[:])
* off = f_i
* for next_nt in nt: # <<<<<<<<<<<<<<
@@ -64252,7 +64317,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__pyx_t_3 = __pyx_v_nt; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_nt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_nt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
@@ -64260,23 +64325,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_2 = __pyx_t_5(__pyx_t_3);
if (unlikely(!__pyx_t_2)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -64285,28 +64350,28 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_XDECREF_SET(__pyx_v_next_nt, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2086
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2091
* off = f_i
* for next_nt in nt:
* nt_len = (next_nt[2] - next_nt[1]) + 1 # <<<<<<<<<<<<<<
* i = 0
* while i < nt_len:
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF_SET(__pyx_v_nt_len, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2087
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2092
* for next_nt in nt:
* nt_len = (next_nt[2] - next_nt[1]) + 1
* i = 0 # <<<<<<<<<<<<<<
@@ -64316,7 +64381,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_int_0);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_int_0);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2088
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2093
* nt_len = (next_nt[2] - next_nt[1]) + 1
* i = 0
* while i < nt_len: # <<<<<<<<<<<<<<
@@ -64324,82 +64389,82 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* i += 1
*/
while (1) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_7) break;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2089
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2094
* i = 0
* while i < nt_len:
* f_sym.pop(next_nt[1] - off) # <<<<<<<<<<<<<<
* i += 1
* f_sym.insert(next_nt[1] - off, sym_setindex(self.category, next_nt[0]))
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_f_sym), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_f_sym), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_v_off); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_v_off); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2090
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2095
* while i < nt_len:
* f_sym.pop(next_nt[1] - off)
* i += 1 # <<<<<<<<<<<<<<
* f_sym.insert(next_nt[1] - off, sym_setindex(self.category, next_nt[0]))
* off += (nt_len - 1)
*/
- __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF_SET(__pyx_v_i, __pyx_t_2);
__pyx_t_2 = 0;
}
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2091
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2096
* f_sym.pop(next_nt[1] - off)
* i += 1
* f_sym.insert(next_nt[1] - off, sym_setindex(self.category, next_nt[0])) # <<<<<<<<<<<<<<
* off += (nt_len - 1)
* e_sym = list(e_span[:])
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_10 = PyList_Insert(__pyx_v_f_sym, __pyx_t_8, __pyx_t_6); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = PyList_Insert(__pyx_v_f_sym, __pyx_t_8, __pyx_t_6); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2092
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2097
* i += 1
* f_sym.insert(next_nt[1] - off, sym_setindex(self.category, next_nt[0]))
* off += (nt_len - 1) # <<<<<<<<<<<<<<
* e_sym = list(e_span[:])
* off = e_i
*/
- __pyx_t_6 = PyNumber_Subtract(__pyx_v_nt_len, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_Subtract(__pyx_v_nt_len, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF_SET(__pyx_v_off, __pyx_t_2);
@@ -64407,27 +64472,27 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2093
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2098
* f_sym.insert(next_nt[1] - off, sym_setindex(self.category, next_nt[0]))
* off += (nt_len - 1)
* e_sym = list(e_span[:]) # <<<<<<<<<<<<<<
* off = e_i
* for next_nt in nt_inv:
*/
- __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_e_span, 0, 0, NULL, NULL, &__pyx_k_slice_149, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_e_span, 0, 0, NULL, NULL, &__pyx_k_slice_149, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_v_e_sym = ((PyObject*)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2094
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2099
* off += (nt_len - 1)
* e_sym = list(e_span[:])
* off = e_i # <<<<<<<<<<<<<<
@@ -64437,7 +64502,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_v_e_i);
__Pyx_DECREF_SET(__pyx_v_off, __pyx_v_e_i);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2095
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2100
* e_sym = list(e_span[:])
* off = e_i
* for next_nt in nt_inv: # <<<<<<<<<<<<<<
@@ -64448,7 +64513,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__pyx_t_3 = __pyx_v_nt_inv; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_nt_inv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_nt_inv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
@@ -64456,23 +64521,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_2 = __pyx_t_5(__pyx_t_3);
if (unlikely(!__pyx_t_2)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -64481,28 +64546,28 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_XDECREF_SET(__pyx_v_next_nt, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2096
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2101
* off = e_i
* for next_nt in nt_inv:
* nt_len = (next_nt[4] - next_nt[3]) + 1 # <<<<<<<<<<<<<<
* i = 0
* while i < nt_len:
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF_SET(__pyx_v_nt_len, __pyx_t_6);
__pyx_t_6 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2097
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2102
* for next_nt in nt_inv:
* nt_len = (next_nt[4] - next_nt[3]) + 1
* i = 0 # <<<<<<<<<<<<<<
@@ -64512,7 +64577,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_int_0);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_int_0);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2098
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2103
* nt_len = (next_nt[4] - next_nt[3]) + 1
* i = 0
* while i < nt_len: # <<<<<<<<<<<<<<
@@ -64520,82 +64585,82 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* i += 1
*/
while (1) {
- __pyx_t_6 = PyObject_RichCompare(__pyx_v_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_RichCompare(__pyx_v_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (!__pyx_t_7) break;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2099
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2104
* i = 0
* while i < nt_len:
* e_sym.pop(next_nt[3] - off) # <<<<<<<<<<<<<<
* i += 1
* e_sym.insert(next_nt[3] - off, sym_setindex(self.category, next_nt[0]))
*/
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_e_sym), __pyx_n_s__pop); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_e_sym), __pyx_n_s__pop); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_off); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_off); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2100
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2105
* while i < nt_len:
* e_sym.pop(next_nt[3] - off)
* i += 1 # <<<<<<<<<<<<<<
* e_sym.insert(next_nt[3] - off, sym_setindex(self.category, next_nt[0]))
* off += (nt_len - 1)
*/
- __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF_SET(__pyx_v_i, __pyx_t_2);
__pyx_t_2 = 0;
}
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2101
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2106
* e_sym.pop(next_nt[3] - off)
* i += 1
* e_sym.insert(next_nt[3] - off, sym_setindex(self.category, next_nt[0])) # <<<<<<<<<<<<<<
* off += (nt_len - 1)
*
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_10 = PyList_Insert(__pyx_v_e_sym, __pyx_t_8, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = PyList_Insert(__pyx_v_e_sym, __pyx_t_8, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2102
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2107
* i += 1
* e_sym.insert(next_nt[3] - off, sym_setindex(self.category, next_nt[0]))
* off += (nt_len - 1) # <<<<<<<<<<<<<<
*
* # Adjusting alignment links takes some doing
*/
- __pyx_t_1 = PyNumber_Subtract(__pyx_v_nt_len, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Subtract(__pyx_v_nt_len, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF_SET(__pyx_v_off, __pyx_t_2);
@@ -64603,20 +64668,20 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2105
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2110
*
* # Adjusting alignment links takes some doing
* links = [list(link) for sub in al for link in sub] # <<<<<<<<<<<<<<
* links_inv = sorted(links, cmp=lambda x, y: cmp(x[1], y[1]))
* links_len = len(links)
*/
- __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if (PyList_CheckExact(__pyx_v_al) || PyTuple_CheckExact(__pyx_v_al)) {
__pyx_t_2 = __pyx_v_al; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_al); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_al); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
}
@@ -64624,23 +64689,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) {
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) {
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_1 = __pyx_t_5(__pyx_t_2);
if (unlikely(!__pyx_t_1)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -64652,7 +64717,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__pyx_t_1 = __pyx_v_sub; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
__pyx_t_11 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sub); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sub); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -64660,23 +64725,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_6 = __pyx_t_11(__pyx_t_1);
if (unlikely(!__pyx_t_6)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -64684,15 +64749,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
}
__Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_6);
__pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_v_link);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_link);
__Pyx_GIVEREF(__pyx_v_link);
- __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_12))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_12))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -64702,32 +64767,32 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__pyx_cur_scope->__pyx_v_links = ((PyObject*)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2106
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2111
* # Adjusting alignment links takes some doing
* links = [list(link) for sub in al for link in sub]
* links_inv = sorted(links, cmp=lambda x, y: cmp(x[1], y[1])) # <<<<<<<<<<<<<<
* links_len = len(links)
* nt_len = len(nt)
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_links));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_links));
__Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_links));
- __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda9, 0, __pyx_n_s_147, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda9, 0, __pyx_n_s_147, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__cmp), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__cmp), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_v_links_inv = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2107
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2112
* links = [list(link) for sub in al for link in sub]
* links_inv = sorted(links, cmp=lambda x, y: cmp(x[1], y[1]))
* links_len = len(links) # <<<<<<<<<<<<<<
@@ -64738,29 +64803,29 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_t_1);
if (unlikely(__pyx_t_1 == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_4 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_links_len = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2108
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2113
* links_inv = sorted(links, cmp=lambda x, y: cmp(x[1], y[1]))
* links_len = len(links)
* nt_len = len(nt) # <<<<<<<<<<<<<<
* nt_i = 0
* off = f_i
*/
- __pyx_t_4 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_nt_len, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2109
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2114
* links_len = len(links)
* nt_len = len(nt)
* nt_i = 0 # <<<<<<<<<<<<<<
@@ -64770,7 +64835,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_int_0);
__pyx_v_nt_i = __pyx_int_0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2110
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2115
* nt_len = len(nt)
* nt_i = 0
* off = f_i # <<<<<<<<<<<<<<
@@ -64780,7 +64845,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_v_f_i);
__Pyx_DECREF_SET(__pyx_v_off, __pyx_v_f_i);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2111
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2116
* nt_i = 0
* off = f_i
* i = 0 # <<<<<<<<<<<<<<
@@ -64790,7 +64855,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_int_0);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_int_0);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2112
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2117
* off = f_i
* i = 0
* while i < links_len: # <<<<<<<<<<<<<<
@@ -64798,12 +64863,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* off += (nt[nt_i][2] - nt[nt_i][1])
*/
while (1) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_links_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_links_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_7) break;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2113
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2118
* i = 0
* while i < links_len:
* while nt_i < nt_len and links[i][0] > nt[nt_i][1]: # <<<<<<<<<<<<<<
@@ -64811,24 +64876,24 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* nt_i += 1
*/
while (1) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_nt_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_nt_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_7) {
- __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_links), __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_links), __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_14 = __pyx_t_13;
} else {
@@ -64836,79 +64901,79 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
}
if (!__pyx_t_14) break;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2114
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2119
* while i < links_len:
* while nt_i < nt_len and links[i][0] > nt[nt_i][1]:
* off += (nt[nt_i][2] - nt[nt_i][1]) # <<<<<<<<<<<<<<
* nt_i += 1
* links[i][0] -= off
*/
- __pyx_t_1 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF_SET(__pyx_v_off, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2115
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2120
* while nt_i < nt_len and links[i][0] > nt[nt_i][1]:
* off += (nt[nt_i][2] - nt[nt_i][1])
* nt_i += 1 # <<<<<<<<<<<<<<
* links[i][0] -= off
* i += 1
*/
- __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF_SET(__pyx_v_nt_i, __pyx_t_2);
__pyx_t_2 = 0;
}
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2116
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2121
* off += (nt[nt_i][2] - nt[nt_i][1])
* nt_i += 1
* links[i][0] -= off # <<<<<<<<<<<<<<
* i += 1
* nt_i = 0
*/
- __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_links), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_links), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_v_off); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_v_off); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__Pyx_SetItemInt(__pyx_t_2, __pyx_t_4, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_t_2, __pyx_t_4, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2117
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2122
* nt_i += 1
* links[i][0] -= off
* i += 1 # <<<<<<<<<<<<<<
* nt_i = 0
* off = e_i
*/
- __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF_SET(__pyx_v_i, __pyx_t_2);
__pyx_t_2 = 0;
}
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2118
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2123
* links[i][0] -= off
* i += 1
* nt_i = 0 # <<<<<<<<<<<<<<
@@ -64918,7 +64983,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_int_0);
__Pyx_DECREF_SET(__pyx_v_nt_i, __pyx_int_0);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2119
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2124
* i += 1
* nt_i = 0
* off = e_i # <<<<<<<<<<<<<<
@@ -64928,7 +64993,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_v_e_i);
__Pyx_DECREF_SET(__pyx_v_off, __pyx_v_e_i);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2120
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2125
* nt_i = 0
* off = e_i
* i = 0 # <<<<<<<<<<<<<<
@@ -64938,7 +65003,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_int_0);
__Pyx_DECREF_SET(__pyx_v_i, __pyx_int_0);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2121
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2126
* off = e_i
* i = 0
* while i < links_len: # <<<<<<<<<<<<<<
@@ -64946,12 +65011,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* off += (nt_inv[nt_i][4] - nt_inv[nt_i][3])
*/
while (1) {
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_v_links_len, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_v_links_len, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (!__pyx_t_14) break;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2122
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2127
* i = 0
* while i < links_len:
* while nt_i < nt_len and links_inv[i][1] > nt_inv[nt_i][3]: # <<<<<<<<<<<<<<
@@ -64959,24 +65024,24 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* nt_i += 1
*/
while (1) {
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_nt_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_nt_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_14) {
- __pyx_t_2 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_13 = __pyx_t_7;
} else {
@@ -64984,79 +65049,79 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
}
if (!__pyx_t_13) break;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2123
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2128
* while i < links_len:
* while nt_i < nt_len and links_inv[i][1] > nt_inv[nt_i][3]:
* off += (nt_inv[nt_i][4] - nt_inv[nt_i][3]) # <<<<<<<<<<<<<<
* nt_i += 1
* links_inv[i][1] -= off
*/
- __pyx_t_2 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF_SET(__pyx_v_off, __pyx_t_3);
__pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2124
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2129
* while nt_i < nt_len and links_inv[i][1] > nt_inv[nt_i][3]:
* off += (nt_inv[nt_i][4] - nt_inv[nt_i][3])
* nt_i += 1 # <<<<<<<<<<<<<<
* links_inv[i][1] -= off
* i += 1
*/
- __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF_SET(__pyx_v_nt_i, __pyx_t_3);
__pyx_t_3 = 0;
}
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2125
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2130
* off += (nt_inv[nt_i][4] - nt_inv[nt_i][3])
* nt_i += 1
* links_inv[i][1] -= off # <<<<<<<<<<<<<<
* i += 1
*
*/
- __pyx_t_3 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = 1;
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__Pyx_SetItemInt(__pyx_t_3, __pyx_t_4, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_t_3, __pyx_t_4, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2126
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2131
* nt_i += 1
* links_inv[i][1] -= off
* i += 1 # <<<<<<<<<<<<<<
*
* # Find lexical span
*/
- __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF_SET(__pyx_v_i, __pyx_t_3);
__pyx_t_3 = 0;
}
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2129
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2134
*
* # Find lexical span
* lex_f_i = f_i # <<<<<<<<<<<<<<
@@ -65066,75 +65131,75 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_v_f_i);
__pyx_v_lex_f_i = __pyx_v_f_i;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2130
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2135
* # Find lexical span
* lex_f_i = f_i
* lex_f_j = f_i + (len(f_span) - 1) # <<<<<<<<<<<<<<
* if nt:
* if nt[0][1] == lex_f_i:
*/
- __pyx_t_4 = PyObject_Length(__pyx_v_f_span); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyInt_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Length(__pyx_v_f_span); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyInt_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyNumber_Add(__pyx_v_f_i, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_v_f_i, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_lex_f_j = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2131
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2136
* lex_f_i = f_i
* lex_f_j = f_i + (len(f_span) - 1)
* if nt: # <<<<<<<<<<<<<<
* if nt[0][1] == lex_f_i:
* lex_f_i += (nt[0][2] - nt[0][1]) + 1
*/
- __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_13) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2132
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2137
* lex_f_j = f_i + (len(f_span) - 1)
* if nt:
* if nt[0][1] == lex_f_i: # <<<<<<<<<<<<<<
* lex_f_i += (nt[0][2] - nt[0][1]) + 1
* if nt[-1][2] == lex_f_j:
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_lex_f_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_lex_f_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_13) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2133
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2138
* if nt:
* if nt[0][1] == lex_f_i:
* lex_f_i += (nt[0][2] - nt[0][1]) + 1 # <<<<<<<<<<<<<<
* if nt[-1][2] == lex_f_j:
* lex_f_j -= (nt[-1][2] - nt[-1][1]) + 1
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_lex_f_i, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_lex_f_i, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF_SET(__pyx_v_lex_f_i, __pyx_t_1);
@@ -65143,49 +65208,49 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
}
__pyx_L24:;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2134
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2139
* if nt[0][1] == lex_f_i:
* lex_f_i += (nt[0][2] - nt[0][1]) + 1
* if nt[-1][2] == lex_f_j: # <<<<<<<<<<<<<<
* lex_f_j -= (nt[-1][2] - nt[-1][1]) + 1
*
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_lex_f_j, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_lex_f_j, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_13) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2135
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2140
* lex_f_i += (nt[0][2] - nt[0][1]) + 1
* if nt[-1][2] == lex_f_j:
* lex_f_j -= (nt[-1][2] - nt[-1][1]) + 1 # <<<<<<<<<<<<<<
*
* # Create rule (f_phrase, e_phrase, links, f_link_min, f_link_max)
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_v_lex_f_j, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_v_lex_f_j, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF_SET(__pyx_v_lex_f_j, __pyx_t_1);
@@ -65197,63 +65262,63 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
}
__pyx_L23:;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2138
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2143
*
* # Create rule (f_phrase, e_phrase, links, f_link_min, f_link_max)
* f = Phrase(f_sym) # <<<<<<<<<<<<<<
* e = Phrase(e_sym)
* a = tuple(self.alignment.link(i, j) for i, j in links)
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_v_f_sym));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f_sym));
__Pyx_GIVEREF(((PyObject *)__pyx_v_f_sym));
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2139
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2144
* # Create rule (f_phrase, e_phrase, links, f_link_min, f_link_max)
* f = Phrase(f_sym)
* e = Phrase(e_sym) # <<<<<<<<<<<<<<
* a = tuple(self.alignment.link(i, j) for i, j in links)
* return (f, e, a, lex_f_i, lex_f_j)
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)__pyx_v_e_sym));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_e_sym));
__Pyx_GIVEREF(((PyObject *)__pyx_v_e_sym));
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_e = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2140
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2145
* f = Phrase(f_sym)
* e = Phrase(e_sym)
* a = tuple(self.alignment.link(i, j) for i, j in links) # <<<<<<<<<<<<<<
* return (f, e, a, lex_f_i, lex_f_j)
*
*/
- __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_a = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2141
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2146
* e = Phrase(e_sym)
* a = tuple(self.alignment.link(i, j) for i, j in links)
* return (f, e, a, lex_f_i, lex_f_j) # <<<<<<<<<<<<<<
@@ -65261,7 +65326,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* # Rule string from rule
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_v_f));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f));
@@ -65349,16 +65414,16 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule(Py
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fmt_rule") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fmt_rule") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -65373,7 +65438,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule(Py
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.fmt_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -65385,7 +65450,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule(Py
}
static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2145
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2150
* # Rule string from rule
* def fmt_rule(self, f, e, a):
* a_str = ' '.join('{0}-{1}'.format(*self.alignment.unlink(packed)) for packed in a) # <<<<<<<<<<<<<<
@@ -65411,7 +65476,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_gen
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator16, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator16, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -65453,13 +65518,13 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a)) { __Pyx_RaiseClosureNameError("a"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a)) { __Pyx_RaiseClosureNameError("a"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_a; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -65467,23 +65532,23 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -65493,24 +65558,24 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_packed, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_150), __pyx_n_s__format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_150), __pyx_n_s__format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->alignment), __pyx_n_s__unlink); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->alignment), __pyx_n_s__unlink); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_packed);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_packed);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_packed);
- __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = PySequence_Tuple(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_Tuple(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
@@ -65531,7 +65596,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
__Pyx_XGOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
PyErr_SetNone(PyExc_StopIteration);
@@ -65551,7 +65616,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
return NULL;
}
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2144
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2149
*
* # Rule string from rule
* def fmt_rule(self, f, e, a): # <<<<<<<<<<<<<<
@@ -65584,30 +65649,30 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_29fmt_rule(st
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_a);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_a);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2145
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2150
* # Rule string from rule
* def fmt_rule(self, f, e, a):
* a_str = ' '.join('{0}-{1}'.format(*self.alignment.unlink(packed)) for packed in a) # <<<<<<<<<<<<<<
* return '[X] ||| {0} ||| {1} ||| {2}'.format(f, e, a_str)
*
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_a_str = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2146
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2151
* def fmt_rule(self, f, e, a):
* a_str = ' '.join('{0}-{1}'.format(*self.alignment.unlink(packed)) for packed in a)
* return '[X] ||| {0} ||| {1} ||| {2}'.format(f, e, a_str) # <<<<<<<<<<<<<<
@@ -65615,9 +65680,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_29fmt_rule(st
* # Lookup online stats for phrase pair (f, e). Return None if no match.
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_151), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_151), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_f);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f);
@@ -65628,7 +65693,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_29fmt_rule(st
__Pyx_INCREF(__pyx_v_a_str);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_a_str);
__Pyx_GIVEREF(__pyx_v_a_str);
- __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
@@ -65668,7 +65733,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__ctx_name,0};
PyObject* values[3] = {0,0,0};
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2150
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2155
* # Lookup online stats for phrase pair (f, e). Return None if no match.
* # IMPORTANT: use get() to avoid adding items to defaultdict
* def online_ctx_lookup(self, f, e, ctx_name=None): # <<<<<<<<<<<<<<
@@ -65694,7 +65759,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("online_ctx_lookup", 0, 2, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("online_ctx_lookup", 0, 2, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (kw_args > 0) {
@@ -65703,7 +65768,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "online_ctx_lookup") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "online_ctx_lookup") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -65720,7 +65785,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("online_ctx_lookup", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("online_ctx_lookup", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.online_ctx_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -65750,7 +65815,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("online_ctx_lookup", 0);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2151
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2156
* # IMPORTANT: use get() to avoid adding items to defaultdict
* def online_ctx_lookup(self, f, e, ctx_name=None):
* if self.online: # <<<<<<<<<<<<<<
@@ -65760,31 +65825,31 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
__pyx_t_1 = (__pyx_v_self->online != 0);
if (__pyx_t_1) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2152
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2157
* def online_ctx_lookup(self, f, e, ctx_name=None):
* if self.online:
* stats = self.online_stats[ctx_name] # <<<<<<<<<<<<<<
* fcount = stats.phrases_f.get(f, 0)
* fsample_count = stats.samples_f.get(f, 0)
*/
- __pyx_t_2 = PyObject_GetItem(__pyx_v_self->online_stats, __pyx_v_ctx_name); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_self->online_stats, __pyx_v_ctx_name); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_v_stats = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2153
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2158
* if self.online:
* stats = self.online_stats[ctx_name]
* fcount = stats.phrases_f.get(f, 0) # <<<<<<<<<<<<<<
* fsample_count = stats.samples_f.get(f, 0)
* d = stats.phrases_fe.get(f, None)
*/
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__phrases_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__phrases_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_f);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f);
@@ -65792,26 +65857,26 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_v_fcount = __pyx_t_4;
__pyx_t_4 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2154
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2159
* stats = self.online_stats[ctx_name]
* fcount = stats.phrases_f.get(f, 0)
* fsample_count = stats.samples_f.get(f, 0) # <<<<<<<<<<<<<<
* d = stats.phrases_fe.get(f, None)
* paircount = d.get(e, 0) if d else 0
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__samples_f); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__samples_f); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_f);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f);
@@ -65819,26 +65884,26 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_v_fsample_count = __pyx_t_3;
__pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2155
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2160
* fcount = stats.phrases_f.get(f, 0)
* fsample_count = stats.samples_f.get(f, 0)
* d = stats.phrases_fe.get(f, None) # <<<<<<<<<<<<<<
* paircount = d.get(e, 0) if d else 0
* return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex_f, stats.bilex_e, stats.bilex_fe)
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__phrases_fe); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__phrases_fe); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_f);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f);
@@ -65846,25 +65911,25 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None);
__Pyx_GIVEREF(Py_None);
- __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_d = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2156
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2161
* fsample_count = stats.samples_f.get(f, 0)
* d = stats.phrases_fe.get(f, None)
* paircount = d.get(e, 0) if d else 0 # <<<<<<<<<<<<<<
* return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex_f, stats.bilex_e, stats.bilex_fe)
* return None
*/
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_d); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_d); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s__get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s__get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_e);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_e);
@@ -65872,7 +65937,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
@@ -65885,7 +65950,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
__pyx_v_paircount = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2157
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2162
* d = stats.phrases_fe.get(f, None)
* paircount = d.get(e, 0) if d else 0
* return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex_f, stats.bilex_e, stats.bilex_fe) # <<<<<<<<<<<<<<
@@ -65893,15 +65958,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_152); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_152); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_f); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_f); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_e); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_e); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_fe); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_fe); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_v_fcount);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fcount);
@@ -65921,7 +65986,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
__pyx_t_5 = 0;
__pyx_t_4 = 0;
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
@@ -65932,7 +65997,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
}
__pyx_L3:;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2158
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2163
* paircount = d.get(e, 0) if d else 0
* return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex_f, stats.bilex_e, stats.bilex_fe)
* return None # <<<<<<<<<<<<<<
@@ -66018,36 +66083,36 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f_j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lex_i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lex_j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__wc)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 5:
if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ntc)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 6:
if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__syms)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "extract") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "extract") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
goto __pyx_L5_argtuple_error;
@@ -66070,7 +66135,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_f_phrases.extract", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -66081,7 +66146,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
return __pyx_r;
}
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2168
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2173
* phrases = set() # (fphrase, lex_i, lex_j)
*
* def extract(f_i, f_j, lex_i, lex_j, wc, ntc, syms): # <<<<<<<<<<<<<<
@@ -66114,33 +66179,33 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2170
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2175
* def extract(f_i, f_j, lex_i, lex_j, wc, ntc, syms):
* # Phrase extraction limits
* if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size: # <<<<<<<<<<<<<<
* return
* # Extend with word
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_f_len)) { __Pyx_RaiseClosureNameError("f_len"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_f_len)) { __Pyx_RaiseClosureNameError("f_len"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_1 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_f_j, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_f_j, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (!__pyx_t_3) {
- __pyx_t_2 = PyNumber_Subtract(__pyx_v_f_j, __pyx_v_f_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Subtract(__pyx_v_f_j, __pyx_v_f_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __pyx_t_5;
} else {
@@ -66148,7 +66213,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
}
if (__pyx_t_6) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2171
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2176
* # Phrase extraction limits
* if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size:
* return # <<<<<<<<<<<<<<
@@ -66162,58 +66227,58 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
}
__pyx_L3:;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2173
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2178
* return
* # Extend with word
* if wc + ntc < self.max_length: # <<<<<<<<<<<<<<
* syms.append(f_words[f_j])
* f = Phrase(syms)
*/
- __pyx_t_4 = PyNumber_Add(__pyx_v_wc, __pyx_v_ntc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Add(__pyx_v_wc, __pyx_v_ntc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_6) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2174
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2179
* # Extend with word
* if wc + ntc < self.max_length:
* syms.append(f_words[f_j]) # <<<<<<<<<<<<<<
* f = Phrase(syms)
* new_lex_i = min(lex_i, f_j)
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2175
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2180
* if wc + ntc < self.max_length:
* syms.append(f_words[f_j])
* f = Phrase(syms) # <<<<<<<<<<<<<<
* new_lex_i = min(lex_i, f_j)
* new_lex_j = max(lex_j, f_j)
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_syms);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_syms);
__Pyx_GIVEREF(__pyx_v_syms);
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2176
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2181
* syms.append(f_words[f_j])
* f = Phrase(syms)
* new_lex_i = min(lex_i, f_j) # <<<<<<<<<<<<<<
@@ -66224,8 +66289,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
__pyx_t_1 = __pyx_v_f_j;
__Pyx_INCREF(__pyx_v_lex_i);
__pyx_t_2 = __pyx_v_lex_i;
- __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (__pyx_t_6) {
__Pyx_INCREF(__pyx_t_1);
@@ -66242,7 +66307,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
__pyx_v_new_lex_i = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2177
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2182
* f = Phrase(syms)
* new_lex_i = min(lex_i, f_j)
* new_lex_j = max(lex_j, f_j) # <<<<<<<<<<<<<<
@@ -66253,8 +66318,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
__pyx_t_1 = __pyx_v_f_j;
__Pyx_INCREF(__pyx_v_lex_j);
__pyx_t_4 = __pyx_v_lex_j;
- __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (__pyx_t_6) {
__Pyx_INCREF(__pyx_t_1);
@@ -66271,19 +66336,19 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
__pyx_v_new_lex_j = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2178
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2183
* new_lex_i = min(lex_i, f_j)
* new_lex_j = max(lex_j, f_j)
* phrases.add((f, new_lex_i, new_lex_j)) # <<<<<<<<<<<<<<
* extract(f_i, f_j + 1, new_lex_i, new_lex_j, wc + 1, ntc, syms)
* syms.pop()
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_phrases)) { __Pyx_RaiseClosureNameError("phrases"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_phrases)) { __Pyx_RaiseClosureNameError("phrases"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_phrases) == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_v_f));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f));
@@ -66294,53 +66359,53 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
__Pyx_INCREF(__pyx_v_new_lex_j);
PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_new_lex_j);
__Pyx_GIVEREF(__pyx_v_new_lex_j);
- __pyx_t_8 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2179
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2184
* new_lex_j = max(lex_j, f_j)
* phrases.add((f, new_lex_i, new_lex_j))
* extract(f_i, f_j + 1, new_lex_i, new_lex_j, wc + 1, ntc, syms) # <<<<<<<<<<<<<<
* syms.pop()
* # Extend with existing non-terminal
*/
- __pyx_t_1 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_4 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_1, __pyx_v_new_lex_i, __pyx_v_new_lex_j, __pyx_t_2, __pyx_v_ntc, __pyx_v_syms); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_4 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_1, __pyx_v_new_lex_i, __pyx_v_new_lex_j, __pyx_t_2, __pyx_v_ntc, __pyx_v_syms); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2180
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2185
* phrases.add((f, new_lex_i, new_lex_j))
* extract(f_i, f_j + 1, new_lex_i, new_lex_j, wc + 1, ntc, syms)
* syms.pop() # <<<<<<<<<<<<<<
* # Extend with existing non-terminal
* if syms and sym_isvar(syms[-1]):
*/
- __pyx_t_4 = __Pyx_PyObject_Pop(__pyx_v_syms); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Pop(__pyx_v_syms); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L4;
}
__pyx_L4:;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2182
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2187
* syms.pop()
* # Extend with existing non-terminal
* if syms and sym_isvar(syms[-1]): # <<<<<<<<<<<<<<
* # Don't re-extract the same phrase
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc, syms)
*/
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_syms); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_syms); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_6) {
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_syms, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_syms, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_9) != 0);
} else {
@@ -66348,17 +66413,17 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
}
if (__pyx_t_3) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2184
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2189
* if syms and sym_isvar(syms[-1]):
* # Don't re-extract the same phrase
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc, syms) # <<<<<<<<<<<<<<
* # Extend with new non-terminal
* if wc + ntc < self.max_length:
*/
- __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_4, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_v_ntc, __pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_4, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_v_ntc, __pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -66366,44 +66431,44 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
}
__pyx_L5:;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2186
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2191
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc, syms)
* # Extend with new non-terminal
* if wc + ntc < self.max_length: # <<<<<<<<<<<<<<
* if not syms or (ntc < self.max_nonterminals and not sym_isvar(syms[-1])):
* syms.append(sym_setindex(self.category, ntc + 1))
*/
- __pyx_t_2 = PyNumber_Add(__pyx_v_wc, __pyx_v_ntc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Add(__pyx_v_wc, __pyx_v_ntc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_3) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2187
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2192
* # Extend with new non-terminal
* if wc + ntc < self.max_length:
* if not syms or (ntc < self.max_nonterminals and not sym_isvar(syms[-1])): # <<<<<<<<<<<<<<
* syms.append(sym_setindex(self.category, ntc + 1))
* f = Phrase(syms)
*/
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_syms); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_syms); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = (!__pyx_t_3);
if (!__pyx_t_6) {
- __pyx_t_1 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_nonterminals); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_nonterminals); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_ntc, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_RichCompare(__pyx_v_ntc, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_3) {
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_syms, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_syms, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_5 = (!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_9) != 0));
__pyx_t_10 = __pyx_t_5;
@@ -66416,67 +66481,67 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
}
if (__pyx_t_3) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2188
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2193
* if wc + ntc < self.max_length:
* if not syms or (ntc < self.max_nonterminals and not sym_isvar(syms[-1])):
* syms.append(sym_setindex(self.category, ntc + 1)) # <<<<<<<<<<<<<<
* f = Phrase(syms)
* if wc > 0:
*/
- __pyx_t_4 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2189
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2194
* if not syms or (ntc < self.max_nonterminals and not sym_isvar(syms[-1])):
* syms.append(sym_setindex(self.category, ntc + 1))
* f = Phrase(syms) # <<<<<<<<<<<<<<
* if wc > 0:
* phrases.add((f, lex_i, lex_j))
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_syms);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_syms);
__Pyx_GIVEREF(__pyx_v_syms);
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_XDECREF_SET(__pyx_v_f, ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_4));
__pyx_t_4 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2190
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2195
* syms.append(sym_setindex(self.category, ntc + 1))
* f = Phrase(syms)
* if wc > 0: # <<<<<<<<<<<<<<
* phrases.add((f, lex_i, lex_j))
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc + 1, syms)
*/
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_3) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2191
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2196
* f = Phrase(syms)
* if wc > 0:
* phrases.add((f, lex_i, lex_j)) # <<<<<<<<<<<<<<
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc + 1, syms)
* syms.pop()
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_phrases)) { __Pyx_RaiseClosureNameError("phrases"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_phrases)) { __Pyx_RaiseClosureNameError("phrases"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_phrases) == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(((PyObject *)__pyx_v_f));
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_f));
@@ -66487,38 +66552,38 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
__Pyx_INCREF(__pyx_v_lex_j);
PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_lex_j);
__Pyx_GIVEREF(__pyx_v_lex_j);
- __pyx_t_8 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
goto __pyx_L8;
}
__pyx_L8:;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2192
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2197
* if wc > 0:
* phrases.add((f, lex_i, lex_j))
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc + 1, syms) # <<<<<<<<<<<<<<
* syms.pop()
*
*/
- __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_4, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_t_1, __pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_4, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_t_1, __pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2193
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2198
* phrases.add((f, lex_i, lex_j))
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc + 1, syms)
* syms.pop() # <<<<<<<<<<<<<<
*
* # Try to extract phrases from every f index
*/
- __pyx_t_2 = __Pyx_PyObject_Pop(__pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Pop(__pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L7;
@@ -66546,7 +66611,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
return __pyx_r;
}
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2163
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2168
* # (Used for EGivenFCoherent)
* # Return set of (fphrase, lex_i, lex_j)
* def get_f_phrases(self, f_words): # <<<<<<<<<<<<<<
@@ -66583,7 +66648,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_33get_f_phras
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_words);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_words);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2165
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2170
* def get_f_phrases(self, f_words):
*
* f_len = len(f_words) # <<<<<<<<<<<<<<
@@ -66592,66 +66657,66 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_33get_f_phras
*/
__pyx_t_1 = __pyx_cur_scope->__pyx_v_f_words;
__Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_cur_scope->__pyx_v_f_len = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2166
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2171
*
* f_len = len(f_words)
* phrases = set() # (fphrase, lex_i, lex_j) # <<<<<<<<<<<<<<
*
* def extract(f_i, f_j, lex_i, lex_j, wc, ntc, syms):
*/
- __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_cur_scope->__pyx_v_phrases = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2168
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2173
* phrases = set() # (fphrase, lex_i, lex_j)
*
* def extract(f_i, f_j, lex_i, lex_j, wc, ntc, syms): # <<<<<<<<<<<<<<
* # Phrase extraction limits
* if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size:
*/
- __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract, 0, __pyx_n_s_155, ((PyObject*)__pyx_cur_scope), __pyx_n_s_102, ((PyObject *)__pyx_k_codeobj_154)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract, 0, __pyx_n_s_155, ((PyObject*)__pyx_cur_scope), __pyx_n_s_102, ((PyObject *)__pyx_k_codeobj_154)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_cur_scope->__pyx_v_extract = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2196
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2201
*
* # Try to extract phrases from every f index
* for f_i from 0 <= f_i < f_len: # <<<<<<<<<<<<<<
* extract(f_i, f_i, f_len, -1, 0, 0, [])
*
*/
- __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_f_len); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_f_len); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (__pyx_v_f_i = 0; __pyx_v_f_i < __pyx_t_3; __pyx_v_f_i++) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2197
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2202
* # Try to extract phrases from every f index
* for f_i from 0 <= f_i < f_len:
* extract(f_i, f_i, f_len, -1, 0, 0, []) # <<<<<<<<<<<<<<
*
* return phrases
*/
- __pyx_t_1 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __pyx_cur_scope->__pyx_v_f_len;
__Pyx_INCREF(__pyx_t_5);
- __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_t_1, __pyx_t_4, __pyx_t_5, __pyx_int_neg_1, __pyx_int_0, __pyx_int_0, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_t_1, __pyx_t_4, __pyx_t_5, __pyx_int_neg_1, __pyx_int_0, __pyx_int_0, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -66660,7 +66725,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_33get_f_phras
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
}
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2199
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2204
* extract(f_i, f_i, f_len, -1, 0, 0, [])
*
* return phrases # <<<<<<<<<<<<<<
@@ -66703,7 +66768,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_36drop_ctx(Py
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ctx_name,0};
PyObject* values[1] = {0};
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2202
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2207
*
* # Drop online stats for a context
* def drop_ctx(self, ctx_name=None): # <<<<<<<<<<<<<<
@@ -66728,7 +66793,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_36drop_ctx(Py
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "drop_ctx") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "drop_ctx") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2207; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -66741,7 +66806,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_36drop_ctx(Py
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("drop_ctx", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("drop_ctx", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2207; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.drop_ctx", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -66763,16 +66828,16 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(st
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("drop_ctx", 0);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2203
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2208
* # Drop online stats for a context
* def drop_ctx(self, ctx_name=None):
* self.online_stats.pop(ctx_name, None) # <<<<<<<<<<<<<<
*
* # Spans are _inclusive_ on both ends [i, j]
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->online_stats, __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->online_stats, __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_ctx_name);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ctx_name);
@@ -66780,7 +66845,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(st
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
__Pyx_GIVEREF(Py_None);
- __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
@@ -66834,16 +66899,16 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_17span_check(PyObject *__pyx_self, PyOb
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "span_check") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "span_check") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -66858,7 +66923,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_17span_check(PyObject *__pyx_self, PyOb
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.span_check", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -66869,7 +66934,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_17span_check(PyObject *__pyx_self, PyOb
return __pyx_r;
}
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2206
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2211
*
* # Spans are _inclusive_ on both ends [i, j]
* def span_check(vec, i, j): # <<<<<<<<<<<<<<
@@ -66888,7 +66953,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("span_check", 0);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2207
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2212
* # Spans are _inclusive_ on both ends [i, j]
* def span_check(vec, i, j):
* k = i # <<<<<<<<<<<<<<
@@ -66898,7 +66963,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
__Pyx_INCREF(__pyx_v_i);
__pyx_v_k = __pyx_v_i;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2208
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2213
* def span_check(vec, i, j):
* k = i
* while k <= j: # <<<<<<<<<<<<<<
@@ -66906,25 +66971,25 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
* return False
*/
while (1) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_v_j, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_v_j, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_2) break;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2209
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2214
* k = i
* while k <= j:
* if vec[k]: # <<<<<<<<<<<<<<
* return False
* k += 1
*/
- __pyx_t_1 = PyObject_GetItem(__pyx_v_vec, __pyx_v_k); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetItem(__pyx_v_vec, __pyx_v_k); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2210
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2215
* while k <= j:
* if vec[k]:
* return False # <<<<<<<<<<<<<<
@@ -66932,7 +66997,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
* return True
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -66941,20 +67006,20 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
}
__pyx_L5:;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2211
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2216
* if vec[k]:
* return False
* k += 1 # <<<<<<<<<<<<<<
* return True
*
*/
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
__pyx_t_1 = 0;
}
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2212
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2217
* return False
* k += 1
* return True # <<<<<<<<<<<<<<
@@ -66962,7 +67027,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
* def span_inc(vec, i, j):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -67015,16 +67080,16 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_19span_inc(PyObject *__pyx_self, PyObje
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "span_inc") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "span_inc") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -67039,7 +67104,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_19span_inc(PyObject *__pyx_self, PyObje
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.span_inc", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -67050,7 +67115,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_19span_inc(PyObject *__pyx_self, PyObje
return __pyx_r;
}
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2214
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2219
* return True
*
* def span_inc(vec, i, j): # <<<<<<<<<<<<<<
@@ -67071,7 +67136,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("span_inc", 0);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2215
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2220
*
* def span_inc(vec, i, j):
* k = i # <<<<<<<<<<<<<<
@@ -67081,7 +67146,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__py
__Pyx_INCREF(__pyx_v_i);
__pyx_v_k = __pyx_v_i;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2216
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2221
* def span_inc(vec, i, j):
* k = i
* while k <= j: # <<<<<<<<<<<<<<
@@ -67089,12 +67154,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__py
* k += 1
*/
while (1) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_v_j, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_v_j, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_2) break;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2217
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2222
* k = i
* while k <= j:
* vec[k] += 1 # <<<<<<<<<<<<<<
@@ -67103,23 +67168,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__py
*/
__Pyx_INCREF(__pyx_v_k);
__pyx_t_1 = __pyx_v_k;
- __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2218
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2223
* while k <= j:
* vec[k] += 1
* k += 1 # <<<<<<<<<<<<<<
*
* def span_dec(vec, i, j):
*/
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
__pyx_t_1 = 0;
@@ -67174,16 +67239,16 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_21span_dec(PyObject *__pyx_self, PyObje
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "span_dec") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "span_dec") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -67198,7 +67263,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_21span_dec(PyObject *__pyx_self, PyObje
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.span_dec", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -67209,7 +67274,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_21span_dec(PyObject *__pyx_self, PyObje
return __pyx_r;
}
-/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2220
+/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2225
* k += 1
*
* def span_dec(vec, i, j): # <<<<<<<<<<<<<<
@@ -67230,7 +67295,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("span_dec", 0);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2221
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2226
*
* def span_dec(vec, i, j):
* k = i # <<<<<<<<<<<<<<
@@ -67240,7 +67305,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__py
__Pyx_INCREF(__pyx_v_i);
__pyx_v_k = __pyx_v_i;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2222
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2227
* def span_dec(vec, i, j):
* k = i
* while k <= j: # <<<<<<<<<<<<<<
@@ -67248,12 +67313,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__py
* k += 1
*/
while (1) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_v_j, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_v_j, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_2) break;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2223
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2228
* k = i
* while k <= j:
* vec[k] -= 1 # <<<<<<<<<<<<<<
@@ -67261,21 +67326,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__py
*/
__Pyx_INCREF(__pyx_v_k);
__pyx_t_1 = __pyx_v_k;
- __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2224
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2229
* while k <= j:
* vec[k] -= 1
* k += 1 # <<<<<<<<<<<<<<
*/
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
__pyx_t_1 = 0;
@@ -76980,39 +77045,39 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_k_slice_146);
__Pyx_GIVEREF(__pyx_k_slice_146);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2083
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2088
* # Substitute in non-terminals
* nt_inv = sorted(nt, cmp=lambda x, y: cmp(x[3], y[3]))
* f_sym = list(f_span[:]) # <<<<<<<<<<<<<<
* off = f_i
* for next_nt in nt:
*/
- __pyx_k_slice_148 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_148)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_slice_148 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_148)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_148);
__Pyx_GIVEREF(__pyx_k_slice_148);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2093
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2098
* f_sym.insert(next_nt[1] - off, sym_setindex(self.category, next_nt[0]))
* off += (nt_len - 1)
* e_sym = list(e_span[:]) # <<<<<<<<<<<<<<
* off = e_i
* for next_nt in nt_inv:
*/
- __pyx_k_slice_149 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_149)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_slice_149 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_149)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_149);
__Pyx_GIVEREF(__pyx_k_slice_149);
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2168
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2173
* phrases = set() # (fphrase, lex_i, lex_j)
*
* def extract(f_i, f_j, lex_i, lex_j, wc, ntc, syms): # <<<<<<<<<<<<<<
* # Phrase extraction limits
* if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size:
*/
- __pyx_k_tuple_153 = PyTuple_Pack(10, ((PyObject *)__pyx_n_s__f_i), ((PyObject *)__pyx_n_s__f_j), ((PyObject *)__pyx_n_s__lex_i), ((PyObject *)__pyx_n_s__lex_j), ((PyObject *)__pyx_n_s__wc), ((PyObject *)__pyx_n_s__ntc), ((PyObject *)__pyx_n_s__syms), ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__new_lex_i), ((PyObject *)__pyx_n_s__new_lex_j)); if (unlikely(!__pyx_k_tuple_153)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_153 = PyTuple_Pack(10, ((PyObject *)__pyx_n_s__f_i), ((PyObject *)__pyx_n_s__f_j), ((PyObject *)__pyx_n_s__lex_i), ((PyObject *)__pyx_n_s__lex_j), ((PyObject *)__pyx_n_s__wc), ((PyObject *)__pyx_n_s__ntc), ((PyObject *)__pyx_n_s__syms), ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__new_lex_i), ((PyObject *)__pyx_n_s__new_lex_j)); if (unlikely(!__pyx_k_tuple_153)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_153);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_153));
- __pyx_k_codeobj_154 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_153, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__extract, 2168, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_154)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_codeobj_154 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_153, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__extract, 2173, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_154)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cdec/sa/_sa.pyx":5
* import gzip
@@ -77117,41 +77182,41 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_174));
__pyx_k_codeobj_175 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__decode_words, 124, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_175)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2206
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2211
*
* # Spans are _inclusive_ on both ends [i, j]
* def span_check(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_k_tuple_177 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_177)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_177 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_177)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_177);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_177));
- __pyx_k_codeobj_178 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_177, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_check, 2206, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_178)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_codeobj_178 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_177, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_check, 2211, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_178)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2214
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2219
* return True
*
* def span_inc(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_k_tuple_179 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_179)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_179 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_179)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_179);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_179));
- __pyx_k_codeobj_180 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_179, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_inc, 2214, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_180)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_codeobj_180 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_179, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_inc, 2219, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_180)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2220
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2225
* k += 1
*
* def span_dec(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_k_tuple_181 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_181)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_181 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_181)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_181);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_181));
- __pyx_k_codeobj_182 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_181, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_dec, 2220, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_182)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_codeobj_182 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_181, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_dec, 2225, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_182)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
@@ -77278,7 +77343,7 @@ PyMODINIT_FUNC PyInit__sa(void)
__pyx_ptype_4cdec_2sa_3_sa_SuffixArray = &__pyx_type_4cdec_2sa_3_sa_SuffixArray;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_LCP) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "LCP", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_LCP) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -77316,7 +77381,7 @@ PyMODINIT_FUNC PyInit__sa(void)
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases;
__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode.tp_base = __pyx_ptype_4cdec_2sa_3_sa_TrieNode;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -77334,7 +77399,7 @@ PyMODINIT_FUNC PyInit__sa(void)
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_19_input = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_input;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_Rule) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "Rule", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Rule) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -77390,13 +77455,13 @@ PyMODINIT_FUNC PyInit__sa(void)
__pyx_ptype_4cdec_2sa_3_sa_TrieTable = &__pyx_type_4cdec_2sa_3_sa_TrieTable;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr;
@@ -77964,40 +78029,40 @@ PyMODINIT_FUNC PyInit__sa(void)
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2206
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2211
*
* # Spans are _inclusive_ on both ends [i, j]
* def span_check(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_17span_check, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_17span_check, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s__span_check, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s__span_check, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2214
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2219
* return True
*
* def span_inc(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_19span_inc, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_19span_inc, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s__span_inc, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s__span_inc, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2220
+ /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2225
* k += 1
*
* def span_dec(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_21span_dec, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_21span_dec, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s__span_dec, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s__span_dec, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":1
diff --git a/python/cdec/sa/compile.py b/python/cdec/sa/compile.py
index caa93f8b..3cdf212f 100644
--- a/python/cdec/sa/compile.py
+++ b/python/cdec/sa/compile.py
@@ -54,6 +54,8 @@ def main():
help='Bitext word alignment')
parser.add_argument('-o', '--output', required=True,
help='Output path')
+ parser.add_argument('--online', action='store_true',
+ help='Compile data for online grammar extraction')
args = parser.parse_args()
if not ((args.source and args.target) or args.bitext):
@@ -74,6 +76,8 @@ def main():
precomp_bin = os.path.join(args.output, precomp_file)
a_bin = os.path.join(args.output, 'a.bin')
lex_bin = os.path.join(args.output, 'lex.bin')
+ # online only
+ bilex_file = os.path.join(args.output, 'bilex.gz')
config = cdec.configobj.ConfigObj(args.config, unrepr=True)
config['f_sa_file'] = os.path.abspath(f_sa_bin)
@@ -81,6 +85,8 @@ def main():
config['a_file'] = os.path.abspath(a_bin)
config['lex_file'] = os.path.abspath(lex_bin)
config['precompute_file'] = os.path.abspath(precomp_bin)
+ if args.online:
+ config['bilex_file'] = os.path.abspath(bilex_file)
start_time = monitor_cpu()
logger.info('Compiling source suffix array')
@@ -122,6 +128,17 @@ def main():
stop_time = monitor_cpu()
logger.info('Compiling bilexical dictionary took %f seconds', stop_time - start_time)
+ if args.online:
+ start_time = monitor_cpu()
+ logger.info('Compiling online bilexical dictionary')
+ if args.bitext:
+ bilex = cdec.sa.online.Bilex(alignment_f=args.alignment, text_f=args.bitext)
+ else:
+ bilex = cdec.sa.online.Bilex(alignment_f=args.alignment, text_f=args.source, text_target_f=args.target)
+ bilex.write(bilex_file)
+ stop_time = monitor_cpu()
+ logger.info('Compiling online bilexical dictionary took %f seconds', stop_time - start_time)
+
# Write configuration
for name, value in zip(param_names, params):
config[name] = value
diff --git a/python/cdec/sa/extract.py b/python/cdec/sa/extract.py
index d8f14b11..b6502c52 100644
--- a/python/cdec/sa/extract.py
+++ b/python/cdec/sa/extract.py
@@ -12,13 +12,12 @@ from cdec.sa._sa import monitor_cpu
extractor, prefix = None, None
online, compress = False, False
-vocab = None
def make_extractor(args):
global extractor, prefix, online, compress
signal.signal(signal.SIGINT, signal.SIG_IGN) # Let parent process catch Ctrl+C
load_features(args.features)
- extractor = cdec.sa.GrammarExtractor(args.config, online, vocab)
+ extractor = cdec.sa.GrammarExtractor(args.config, online)
prefix = args.grammars
online = args.online
compress = args.compress
@@ -64,7 +63,7 @@ def extract(inp):
return '<seg grammar="{}" id="{}">{}</seg>{}'.format(grammar_file, i, sentence, suffix)
def main():
- global online, vocab
+ global online
logging.basicConfig(level=logging.INFO)
parser = argparse.ArgumentParser(description='Extract grammars from a compiled corpus.')
parser.add_argument('-c', '--config', required=True,
@@ -79,8 +78,6 @@ def main():
help='additional feature definitions')
parser.add_argument('-o', '--online', action='store_true',
help='online grammar extraction')
- parser.add_argument('-e', '--except-vocab', default=None,
- help='add LM and Lex except features (use with -o, pass vocab.gz)')
parser.add_argument('-z', '--compress', action='store_true',
help='compress grammars with gzip')
args = parser.parse_args()
@@ -94,7 +91,6 @@ def main():
sys.exit(1)
online = args.online
- vocab = args.except_vocab
start_time = monitor_cpu()
if args.jobs > 1:
diff --git a/python/cdec/sa/extractor.py b/python/cdec/sa/extractor.py
index 244f84be..25313cc3 100644
--- a/python/cdec/sa/extractor.py
+++ b/python/cdec/sa/extractor.py
@@ -4,14 +4,14 @@ import cdec.configobj
from cdec.sa._sa import gzip_or_text
from cdec.sa.features import EgivenFCoherent, SampleCountF, CountEF,\
MaxLexEgivenF, MaxLexFgivenE, IsSingletonF, IsSingletonFE,\
- IsSupportedOnline, CountExceptLM, CountExceptLex
+ IsSupportedOnline, CountExceptLM
import cdec.sa
# maximum span of a grammar rule in TEST DATA
MAX_INITIAL_SIZE = 15
class GrammarExtractor:
- def __init__(self, config, online=False, vocab=None, features=None):
+ def __init__(self, config, online=False, features=None):
if isinstance(config, basestring):
if not os.path.exists(config):
raise IOError('cannot read configuration from {0}'.format(config))
@@ -60,13 +60,13 @@ class GrammarExtractor:
tt = cdec.sa.BiLex(from_binary=config['lex_file'])
# TODO: clean this up
+ # Load data and add features for online grammar extraction
extended_features = []
if online:
extended_features.append(IsSupportedOnline)
- if vocab:
+ vocab_file = config['vocab_file']
vcb_set = set(line.strip() for line in gzip_or_text(vocab))
extended_features.append(CountExceptLM(vcb_set))
- extended_features.append(CountExceptLex(tt))
# TODO: use @cdec.sa.features decorator for standard features too
# + add a mask to disable features
diff --git a/python/cdec/sa/features.py b/python/cdec/sa/features.py
index dcc60401..3e6af859 100644
--- a/python/cdec/sa/features.py
+++ b/python/cdec/sa/features.py
@@ -145,9 +145,3 @@ def CountExceptLM(vocab):
def CountExceptLM(ctx): # Word count in bitext (inc online data) but NOT mono text
return sum(1 for e in ctx.ephrase.words if e not in vocab)
return CountExceptLM
-
-def CountExceptLex(ttable):
- def CountExceptLex(ctx): # Word count in online data but NOT aligned in original bitext
- # TODO: Check that online data actually contains aligned word when rulefactory TODO is addressed.
- return sum(1 for e in ctx.ephrase.words if not ttable.contains_e_word(e))
- return CountExceptLex
diff --git a/python/cdec/sa/online.py b/python/cdec/sa/online.py
new file mode 100644
index 00000000..92f6eae2
--- /dev/null
+++ b/python/cdec/sa/online.py
@@ -0,0 +1,95 @@
+from __future__ import division
+
+import collections
+import gzip
+import itertools
+
+from cdec.sa._sa import gzip_or_text
+
+# Same as Cython implementation. Collisions with NULL in bitext?
+NULL_WORD = 'NULL'
+
+def learn_vocab(text_f):
+ vocab = set()
+ for line in gzip_or_text(text_f):
+ for word in line.strip().split():
+ vocab.add(word)
+ return vocab
+
+def write_vocab(vocab, out_f):
+ with gzip.open(out_f, 'wb') as out:
+ for word in sorted(vocab):
+ out.write('{}\n'.format(word))
+
+def read_vocab(in_f):
+ return set(line.strip() for line in gzip_or_text(in_f))
+
+class Bilex:
+
+ def __init__(self, in_f=None, alignment_f=None, text_f=None, target_text_f=None):
+ self.f = collections.defaultdict(int)
+ self.e = collections.defaultdict(int)
+ self.fe = collections.defaultdict(lambda: collections.defaultdict(int))
+ self.ef = collections.defaultdict(lambda: collections.defaultdict(int))
+
+ # Read from file
+ if in_f:
+ self.read(in_f)
+ # Build from aligned bitext
+ elif alignment_f:
+ # Allow one or two args for bitext
+ if target_text_f:
+ t = itertools.izip((line.strip() for line in gzip_or_text(text_f)), (line.strip() for line in gzip_or_text(target_text_f)))
+ else:
+ t = (line.strip().split(' ||| ') for line in gzip_or_text(text_f))
+ a = (line.strip() for line in gzip_or_text(alignment_f))
+ for (source, target) in t:
+ links = sorted(tuple(int(link) for link in link_str.split('-')) for link_str in a.next().split())
+ self.update(source.split(), target.split(), links)
+
+ # Add bilex counts from new aligned sentence pair
+ def update(self, f_words, e_words, links):
+ aligned_fe = [list() for _ in range(len(f_words))]
+ aligned_ef = [list() for _ in range(len(e_words))]
+ for (i, j) in links:
+ aligned_fe[i].append(j)
+ aligned_ef[j].append(i)
+ for f_i in range(len(f_words)):
+ self.f[f_words[f_i]] += 1
+ e_i_aligned = aligned_fe[f_i]
+ lc = len(e_i_aligned)
+ if lc > 0:
+ for e_i in e_i_aligned:
+ self.fe[f_words[f_i]][e_words[e_i]] += (1 / lc)
+ else:
+ self.fe[f_words[f_i]][NULL_WORD] += 1
+ for e_i in range(len(e_words)):
+ self.e[e_words[e_i]] += 1
+ f_i_aligned = aligned_ef[e_i]
+ lc = len(f_i_aligned)
+ if lc > 0:
+ for f_i in f_i_aligned:
+ self.ef[e_words[e_i]][f_words[f_i]] += (1 / lc)
+ else:
+ self.ef[e_words[e_i]][NULL_WORD] += 1
+
+ def write(self, out_f):
+ fv = sorted(self.f)
+ ev = sorted(self.e)
+ with gzip.open(out_f, 'wb') as out:
+ for f in fv:
+ out.write('{} {}\n'.format(f, self.f[f]))
+ out.write('\n')
+ for e in ev:
+ out.write('{} {}\n'.format(e, self.e[e]))
+ out.write('\n')
+ for f in fv:
+ for (e, c) in sorted(self.fe[f].iteritems()):
+ out.write('{} {} {}\n'.format(f, e, c))
+ for e in ev:
+ for (f, c) in sorted(self.ef[e].iteritems()):
+ out.write('{} {} {}\n'.format(e, f, c))
+
+ def read(self, in_f):
+ with gzip_or_text(in_f) as inp:
+ pass
diff --git a/python/cdec/sa/rulefactory.pxi b/python/cdec/sa/rulefactory.pxi
index 044a78c8..86b994b9 100644
--- a/python/cdec/sa/rulefactory.pxi
+++ b/python/cdec/sa/rulefactory.pxi
@@ -2057,23 +2057,28 @@ cdef class HieroCachingRuleFactory:
# Update Bilexical counts
aligned_fe = [list() for _ in range(len(f_words))]
aligned_ef = [list() for _ in range(len(e_words))]
+ null_word = sym_fromstring('NULL', True)
for (i, j) in alignment:
aligned_fe[i].append(j)
aligned_ef[j].append(i)
for f_i in range(len(f_words)):
+ stats.bilex_f[f_words[f_i]] += 1
e_i_aligned = aligned_fe[f_i]
lc = len(e_i_aligned)
if lc > 0:
- stats.bilex_f[f_words[f_i]] += 1
for e_i in e_i_aligned:
stats.bilex_fe[f_words[f_i]][e_words[e_i]] += (1.0) / lc
+ else:
+ stats.bilex_fe[f_words[f_i]][null_word] += 1
for e_i in range(len(e_words)):
+ stats.bilex_e[e_words[e_i]] += 1
f_i_aligned = aligned_ef[e_i]
lc = len(f_i_aligned)
if lc > 0:
- stats.bilex_e[e_words[e_i]] += 1
for f_i in f_i_aligned:
stats.bilex_ef[e_words[e_i]][f_words[f_i]] += (1.0) / lc
+ else:
+ stats.bilex_ef[e_words[e_i]][null_word] += 1
# Create a rule from source, target, non-terminals, and alignments
def form_rule(self, f_i, e_i, f_span, e_span, nt, al):