summaryrefslogtreecommitdiff
path: root/python/src/sa/_sa.c
diff options
context:
space:
mode:
Diffstat (limited to 'python/src/sa/_sa.c')
-rw-r--r--python/src/sa/_sa.c8484
1 files changed, 4091 insertions, 4393 deletions
diff --git a/python/src/sa/_sa.c b/python/src/sa/_sa.c
index 20eecf38..15544970 100644
--- a/python/src/sa/_sa.c
+++ b/python/src/sa/_sa.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.17.1 on Fri Dec 28 02:41:30 2012 */
+/* Generated by Cython 0.17.1 on Mon Jan 7 22:31:38 2013 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -360,7 +360,7 @@ static const char *__pyx_f[] = {
struct __pyx_obj_3_sa_HieroCachingRuleFactory;
struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence;
struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr;
-struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule;
+struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule;
struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats;
struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr;
struct __pyx_obj_3_sa___pyx_scope_struct_22_genexpr;
@@ -603,14 +603,14 @@ struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr {
};
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2086
- * return rules
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1992
*
- * def new_rule(self, f_sym, e_sym, links): # <<<<<<<<<<<<<<
- * f = Phrase(f_sym)
- * e = Phrase(e_sym)
+ * # Create a rule from source, target, non-terminals, and alignments
+ * def form_rule(self, f_i, e_i, f_span, e_span, nt, al): # <<<<<<<<<<<<<<
+ *
+ * # Substitute in non-terminals
*/
-struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule {
+struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule {
PyObject_HEAD
PyObject *__pyx_v_links;
struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self;
@@ -665,16 +665,16 @@ struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr {
};
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2089
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2053
* f = Phrase(f_sym)
* e = Phrase(e_sym)
* a = tuple(self.alignment.link(i, j) for (i, j) in links) # <<<<<<<<<<<<<<
- * return (f, e, a)
+ * return (f, e, a, lex_f_i, lex_f_j)
*
*/
struct __pyx_obj_3_sa___pyx_scope_struct_22_genexpr {
PyObject_HEAD
- struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule *__pyx_outer_scope;
+ struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule *__pyx_outer_scope;
PyObject *__pyx_v_i;
PyObject *__pyx_v_j;
PyObject *__pyx_t_0;
@@ -840,12 +840,14 @@ struct __pyx_obj_3_sa_Precomputation {
struct __pyx_obj_3_sa___pyx_scope_struct_20_add_instance {
PyObject_HEAD
PyObject *__pyx_v_al;
- PyObject *__pyx_v_al_span;
PyObject *__pyx_v_cover;
+ PyObject *__pyx_v_e_nt_cover;
PyObject *__pyx_v_e_words;
+ PyObject *__pyx_v_ef_span;
PyObject *__pyx_v_extract;
PyObject *__pyx_v_f_len;
PyObject *__pyx_v_f_words;
+ PyObject *__pyx_v_fe_span;
PyObject *__pyx_v_rules;
struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self;
};
@@ -1008,9 +1010,9 @@ struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ {
};
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2092
- * return (f, e, a)
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2057
*
+ * # 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)
@@ -1022,8 +1024,8 @@ struct __pyx_obj_3_sa___pyx_scope_struct_23_fmt_rule {
};
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2093
- *
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2058
+ * # 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)
@@ -2369,7 +2371,7 @@ static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_17_genexpr = 0;
static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_18_alignments = 0;
static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_19_input = 0;
static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_20_add_instance = 0;
-static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_21_new_rule = 0;
+static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_21_form_rule = 0;
static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_22_genexpr = 0;
static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_23_fmt_rule = 0;
static PyTypeObject *__pyx_ptype_3_sa___pyx_scope_struct_24_genexpr = 0;
@@ -2642,17 +2644,18 @@ static PyObject *__pyx_lambda_funcdef_lambda5(CYTHON_UNUSED PyObject *__pyx_self
static PyObject *__pyx_lambda_funcdef_lambda4(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_22input(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_meta); /* proto */
-static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(PyObject *__pyx_self, PyObject *__pyx_v_f_i, PyObject *__pyx_v_f_j, PyObject *__pyx_v_e_i, PyObject *__pyx_v_e_j, PyObject *__pyx_v_wc, PyObject *__pyx_v_links, PyObject *__pyx_v_nt, PyObject *__pyx_v_nt_open); /* proto */
+static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(PyObject *__pyx_self, PyObject *__pyx_v_f_i, PyObject *__pyx_v_f_j, PyObject *__pyx_v_e_i, PyObject *__pyx_v_e_j, PyObject *__pyx_v_min_bound, PyObject *__pyx_v_wc, PyObject *__pyx_v_links, PyObject *__pyx_v_nt, PyObject *__pyx_v_nt_open); /* proto */
static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_words, PyObject *__pyx_v_e_words, PyObject *__pyx_v_alignment); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
-static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_i, PyObject *__pyx_v_e_i, PyObject *__pyx_v_f_span, PyObject *__pyx_v_e_span, PyObject *__pyx_v_nt, PyObject *__pyx_v_al); /* proto */
-static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8new_rule_genexpr(PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_29new_rule(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_sym, PyObject *__pyx_v_e_sym, PyObject *__pyx_v_links); /* proto */
+static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
+static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_i, PyObject *__pyx_v_e_i, PyObject *__pyx_v_f_span, PyObject *__pyx_v_e_span, PyObject *__pyx_v_nt, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_31fmt_rule(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_a); /* proto */
-static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_33dump_online_stats(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_29fmt_rule(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_a); /* proto */
+static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_31dump_online_stats(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3_sa_12span_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */
-static PyObject *__pyx_pf_3_sa_14span_flip(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */
+static PyObject *__pyx_pf_3_sa_14span_inc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */
+static PyObject *__pyx_pf_3_sa_16span_dec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */
static int __pyx_pf_3_sa_13FeatureVector___cinit__(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3_sa_13FeatureVector_2set(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self, unsigned int __pyx_v_name, float __pyx_v_value); /* proto */
static PyObject *__pyx_pf_3_sa_13FeatureVector_4__iter__(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self); /* proto */
@@ -2762,7 +2765,7 @@ static char __pyx_k_137[] = "{0}-{1}";
static char __pyx_k_138[] = "[X] ||| {0} ||| {1} ||| {2}";
static char __pyx_k_139[] = "------------------------------";
static char __pyx_k_141[] = " Online Stats ";
-static char __pyx_k_148[] = " : ";
+static char __pyx_k_145[] = " : ";
static char __pyx_k_151[] = "%s=%s";
static char __pyx_k_154[] = "/home/m/workspace/cdec/python/src/sa/_sa.pyx";
static char __pyx_k_155[] = "cdec.sa";
@@ -2808,7 +2811,6 @@ static char __pyx_k__link[] = "link";
static char __pyx_k__meta[] = "meta";
static char __pyx_k__name[] = "name";
static char __pyx_k__open[] = "open";
-static char __pyx_k__rule[] = "rule";
static char __pyx_k__seek[] = "seek";
static char __pyx_k__side[] = "side";
static char __pyx_k__size[] = "size";
@@ -2821,9 +2823,7 @@ static char __pyx_k___SEP_[] = "_SEP_";
static char __pyx_k__arity[] = "arity";
static char __pyx_k__chain[] = "chain";
static char __pyx_k__debug[] = "debug";
-static char __pyx_k__e_sym[] = "e_sym";
static char __pyx_k__eword[] = "eword";
-static char __pyx_k__f_sym[] = "f_sym";
static char __pyx_k__fword[] = "fword";
static char __pyx_k__ifrom[] = "ifrom";
static char __pyx_k__index[] = "index";
@@ -2905,19 +2905,20 @@ static char __pyx_k__get_f_id[] = "get_f_id";
static char __pyx_k__get_word[] = "get_word";
static char __pyx_k__getchunk[] = "getchunk";
static char __pyx_k__min_dist[] = "min_dist";
-static char __pyx_k__new_rule[] = "new_rule";
static char __pyx_k__resource[] = "resource";
static char __pyx_k__ru_stime[] = "ru_stime";
static char __pyx_k__ru_utime[] = "ru_utime";
static char __pyx_k__shortest[] = "shortest";
+static char __pyx_k__span_dec[] = "span_dec";
+static char __pyx_k__span_inc[] = "span_inc";
static char __pyx_k__word_ids[] = "word_ids";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k__INCREMENT[] = "INCREMENT";
static char __pyx_k__TypeError[] = "TypeError";
static char __pyx_k____enter__[] = "__enter__";
static char __pyx_k__alignment[] = "alignment";
-static char __pyx_k__collision[] = "collision";
static char __pyx_k__enumerate[] = "enumerate";
+static char __pyx_k__form_rule[] = "form_rule";
static char __pyx_k__from_data[] = "from_data";
static char __pyx_k__from_text[] = "from_text";
static char __pyx_k__getLogger[] = "getLogger";
@@ -2925,15 +2926,14 @@ static char __pyx_k__getrusage[] = "getrusage";
static char __pyx_k__increment[] = "increment";
static char __pyx_k__iteritems[] = "iteritems";
static char __pyx_k__itertools[] = "itertools";
+static char __pyx_k__min_bound[] = "min_bound";
static char __pyx_k__paircount[] = "paircount";
static char __pyx_k__partition[] = "partition";
static char __pyx_k__reachable[] = "reachable";
static char __pyx_k__read_text[] = "read_text";
-static char __pyx_k__span_flip[] = "span_flip";
static char __pyx_k__use_index[] = "use_index";
static char __pyx_k__IndexError[] = "IndexError";
static char __pyx_k__alignments[] = "alignments";
-static char __pyx_k__form_rules[] = "form_rules";
static char __pyx_k__from_stats[] = "from_stats";
static char __pyx_k__input_span[] = "input_span";
static char __pyx_k__itervalues[] = "itervalues";
@@ -2966,10 +2966,12 @@ static char __pyx_k__encode_words[] = "encode_words";
static char __pyx_k__gzip_or_text[] = "gzip_or_text";
static char __pyx_k__make_lattice[] = "make_lattice";
static char __pyx_k__min_gap_size[] = "min_gap_size";
+static char __pyx_k__nt_collision[] = "nt_collision";
static char __pyx_k__StopIteration[] = "StopIteration";
static char __pyx_k__alphabet_size[] = "alphabet_size";
static char __pyx_k__from_iterable[] = "from_iterable";
static char __pyx_k__fsample_count[] = "fsample_count";
+static char __pyx_k__new_min_bound[] = "new_min_bound";
static char __pyx_k__test_sentence[] = "test_sentence";
static char __pyx_k__tight_phrases[] = "tight_phrases";
static char __pyx_k__FeatureContext[] = "FeatureContext";
@@ -3032,7 +3034,7 @@ static PyObject *__pyx_kp_s_138;
static PyObject *__pyx_kp_s_139;
static PyObject *__pyx_kp_s_14;
static PyObject *__pyx_kp_s_141;
-static PyObject *__pyx_kp_s_148;
+static PyObject *__pyx_kp_s_145;
static PyObject *__pyx_kp_s_151;
static PyObject *__pyx_kp_s_154;
static PyObject *__pyx_kp_s_155;
@@ -3131,7 +3133,6 @@ static PyObject *__pyx_n_s__cmp;
static PyObject *__pyx_n_s__col;
static PyObject *__pyx_n_s__collect;
static PyObject *__pyx_n_s__collections;
-static PyObject *__pyx_n_s__collision;
static PyObject *__pyx_n_s__curr_idx;
static PyObject *__pyx_n_s__debug;
static PyObject *__pyx_n_s__decode_lattice;
@@ -3143,7 +3144,6 @@ static PyObject *__pyx_n_s__e;
static PyObject *__pyx_n_s__e_i;
static PyObject *__pyx_n_s__e_j;
static PyObject *__pyx_n_s__e_span;
-static PyObject *__pyx_n_s__e_sym;
static PyObject *__pyx_n_s__e_text;
static PyObject *__pyx_n_s__e_words;
static PyObject *__pyx_n_s__earray;
@@ -3160,14 +3160,13 @@ static PyObject *__pyx_n_s__f;
static PyObject *__pyx_n_s__f_i;
static PyObject *__pyx_n_s__f_j;
static PyObject *__pyx_n_s__f_span;
-static PyObject *__pyx_n_s__f_sym;
static PyObject *__pyx_n_s__f_text;
static PyObject *__pyx_n_s__f_words;
static PyObject *__pyx_n_s__fcount;
static PyObject *__pyx_n_s__fe;
static PyObject *__pyx_n_s__filename;
static PyObject *__pyx_n_s__fmt_rule;
-static PyObject *__pyx_n_s__form_rules;
+static PyObject *__pyx_n_s__form_rule;
static PyObject *__pyx_n_s__format;
static PyObject *__pyx_n_s__fphrase;
static PyObject *__pyx_n_s__from_binary;
@@ -3234,15 +3233,17 @@ static PyObject *__pyx_n_s__max_target_chunks;
static PyObject *__pyx_n_s__max_target_length;
static PyObject *__pyx_n_s__merge;
static PyObject *__pyx_n_s__meta;
+static PyObject *__pyx_n_s__min_bound;
static PyObject *__pyx_n_s__min_dist;
static PyObject *__pyx_n_s__min_gap_size;
static PyObject *__pyx_n_s__name;
static PyObject *__pyx_n_s__namedtuple;
static PyObject *__pyx_n_s__new_e_i;
static PyObject *__pyx_n_s__new_e_j;
-static PyObject *__pyx_n_s__new_rule;
+static PyObject *__pyx_n_s__new_min_bound;
static PyObject *__pyx_n_s__next_states;
static PyObject *__pyx_n_s__nt;
+static PyObject *__pyx_n_s__nt_collision;
static PyObject *__pyx_n_s__nt_open;
static PyObject *__pyx_n_s__num_subpatterns;
static PyObject *__pyx_n_s__offset;
@@ -3275,7 +3276,6 @@ static PyObject *__pyx_n_s__reset;
static PyObject *__pyx_n_s__resource;
static PyObject *__pyx_n_s__ru_stime;
static PyObject *__pyx_n_s__ru_utime;
-static PyObject *__pyx_n_s__rule;
static PyObject *__pyx_n_s__sa;
static PyObject *__pyx_n_s__sa_high;
static PyObject *__pyx_n_s__sa_low;
@@ -3294,7 +3294,8 @@ static PyObject *__pyx_n_s__skip;
static PyObject *__pyx_n_s__sorted;
static PyObject *__pyx_n_s__source;
static PyObject *__pyx_n_s__span_check;
-static PyObject *__pyx_n_s__span_flip;
+static PyObject *__pyx_n_s__span_dec;
+static PyObject *__pyx_n_s__span_inc;
static PyObject *__pyx_n_s__spanlen;
static PyObject *__pyx_n_s__split;
static PyObject *__pyx_n_s__start;
@@ -3390,9 +3391,9 @@ static PyObject *__pyx_k_tuple_140;
static PyObject *__pyx_k_tuple_142;
static PyObject *__pyx_k_tuple_143;
static PyObject *__pyx_k_tuple_144;
-static PyObject *__pyx_k_tuple_145;
static PyObject *__pyx_k_tuple_146;
static PyObject *__pyx_k_tuple_147;
+static PyObject *__pyx_k_tuple_148;
static PyObject *__pyx_k_tuple_149;
static PyObject *__pyx_k_tuple_150;
static PyObject *__pyx_k_tuple_152;
@@ -3404,6 +3405,7 @@ static PyObject *__pyx_k_tuple_164;
static PyObject *__pyx_k_tuple_166;
static PyObject *__pyx_k_tuple_169;
static PyObject *__pyx_k_tuple_171;
+static PyObject *__pyx_k_tuple_173;
static PyObject *__pyx_k_codeobj_135;
static PyObject *__pyx_k_codeobj_153;
static PyObject *__pyx_k_codeobj_158;
@@ -3413,6 +3415,7 @@ static PyObject *__pyx_k_codeobj_165;
static PyObject *__pyx_k_codeobj_167;
static PyObject *__pyx_k_codeobj_170;
static PyObject *__pyx_k_codeobj_172;
+static PyObject *__pyx_k_codeobj_174;
/* "_sa.pyx":5
* import gzip
@@ -56865,6 +56868,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_12add_instance_1extract
PyObject *__pyx_v_f_j = 0;
PyObject *__pyx_v_e_i = 0;
PyObject *__pyx_v_e_j = 0;
+ PyObject *__pyx_v_min_bound = 0;
PyObject *__pyx_v_wc = 0;
PyObject *__pyx_v_links = 0;
PyObject *__pyx_v_nt = 0;
@@ -56873,12 +56877,13 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_12add_instance_1extract
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("extract (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f_i,&__pyx_n_s__f_j,&__pyx_n_s__e_i,&__pyx_n_s__e_j,&__pyx_n_s__wc,&__pyx_n_s__links,&__pyx_n_s__nt,&__pyx_n_s__nt_open,0};
- PyObject* values[8] = {0,0,0,0,0,0,0,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f_i,&__pyx_n_s__f_j,&__pyx_n_s__e_i,&__pyx_n_s__e_j,&__pyx_n_s__min_bound,&__pyx_n_s__wc,&__pyx_n_s__links,&__pyx_n_s__nt,&__pyx_n_s__nt_open,0};
+ PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
+ case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
@@ -56898,43 +56903,48 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_12add_instance_1extract
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f_j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 8, 8, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e_i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 8, 8, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e_j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 8, 8, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
- if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__wc)) != 0)) kw_args--;
+ if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_bound)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 8, 8, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 5:
- if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__links)) != 0)) kw_args--;
+ if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__wc)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 8, 8, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 6:
- if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nt)) != 0)) kw_args--;
+ if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__links)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 8, 8, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 7:
- if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nt_open)) != 0)) kw_args--;
+ if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nt)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 8, 8, 7); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 7); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ case 8:
+ if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nt_open)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 8); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __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 = 1850; __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 = 1861; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
- } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
@@ -56945,63 +56955,70 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_12add_instance_1extract
values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
+ values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
}
__pyx_v_f_i = values[0];
__pyx_v_f_j = values[1];
__pyx_v_e_i = values[2];
__pyx_v_e_j = values[3];
- __pyx_v_wc = values[4];
- __pyx_v_links = values[5];
- __pyx_v_nt = values[6];
- __pyx_v_nt_open = values[7];
+ __pyx_v_min_bound = values[4];
+ __pyx_v_wc = values[5];
+ __pyx_v_links = values[6];
+ __pyx_v_nt = values[7];
+ __pyx_v_nt_open = values[8];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("extract", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_sa.HieroCachingRuleFactory.add_instance.extract", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_self, __pyx_v_f_i, __pyx_v_f_j, __pyx_v_e_i, __pyx_v_e_j, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, __pyx_v_nt_open);
+ __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_self, __pyx_v_f_i, __pyx_v_f_j, __pyx_v_e_i, __pyx_v_e_j, __pyx_v_min_bound, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, __pyx_v_nt_open);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1850
- * # Extract all possible hierarchical phrases starting at a source index
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1861
* # f_ i and j are current, e_ i and j are previous
- * def extract(f_i, f_j, e_i, e_j, wc, links, nt, nt_open): # <<<<<<<<<<<<<<
+ * # We care _considering_ f_j, so it is not yet in counts
+ * def extract(f_i, f_j, e_i, e_j, min_bound, wc, links, nt, nt_open): # <<<<<<<<<<<<<<
* # Phrase extraction limits
- * if wc + len(nt) > self.max_length or (f_j + 1) > f_len or \
+ * if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size:
*/
-static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(PyObject *__pyx_self, PyObject *__pyx_v_f_i, PyObject *__pyx_v_f_j, PyObject *__pyx_v_e_i, PyObject *__pyx_v_e_j, PyObject *__pyx_v_wc, PyObject *__pyx_v_links, PyObject *__pyx_v_nt, PyObject *__pyx_v_nt_open) {
+static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(PyObject *__pyx_self, PyObject *__pyx_v_f_i, PyObject *__pyx_v_f_j, PyObject *__pyx_v_e_i, PyObject *__pyx_v_e_j, PyObject *__pyx_v_min_bound, PyObject *__pyx_v_wc, PyObject *__pyx_v_links, PyObject *__pyx_v_nt, PyObject *__pyx_v_nt_open) {
struct __pyx_obj_3_sa___pyx_scope_struct_20_add_instance *__pyx_cur_scope;
struct __pyx_obj_3_sa___pyx_scope_struct_20_add_instance *__pyx_outer_scope;
PyObject *__pyx_v_link_i = NULL;
PyObject *__pyx_v_link_j = NULL;
PyObject *__pyx_v_new_e_i = NULL;
PyObject *__pyx_v_new_e_j = NULL;
- PyObject *__pyx_v_old_last_nt = NULL;
- PyObject *__pyx_v_rule = NULL;
- int __pyx_v_collision;
+ PyObject *__pyx_v_new_min_bound = NULL;
+ PyObject *__pyx_v_i = NULL;
+ int __pyx_v_nt_collision;
PyObject *__pyx_v_link = NULL;
PyObject *__pyx_v_plus_links = NULL;
+ PyObject *__pyx_v_old_last_nt = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
- Py_ssize_t __pyx_t_1;
+ PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
int __pyx_t_6;
- int __pyx_t_7;
- int __pyx_t_8;
- PyObject *__pyx_t_9 = NULL;
- Py_ssize_t __pyx_t_10;
- PyObject *(*__pyx_t_11)(PyObject *);
- int __pyx_t_12;
+ Py_ssize_t __pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
+ int __pyx_t_9;
+ int __pyx_t_10;
+ int __pyx_t_11;
+ PyObject *(*__pyx_t_12)(PyObject *);
+ int __pyx_t_13;
+ Py_ssize_t __pyx_t_14;
+ PyObject *__pyx_t_15 = NULL;
+ int __pyx_t_16;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -57009,69 +57026,43 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(
__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_20_add_instance *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1852
- * def extract(f_i, f_j, e_i, e_j, wc, links, nt, nt_open):
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1863
+ * def extract(f_i, f_j, e_i, e_j, min_bound, wc, links, nt, nt_open):
* # Phrase extraction limits
- * if wc + len(nt) > self.max_length or (f_j + 1) > f_len or \ # <<<<<<<<<<<<<<
- * (f_j - f_i) + 1 > self.max_initial_size:
+ * if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size: # <<<<<<<<<<<<<<
* return
+ * # Unaligned word
*/
- __pyx_t_1 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyNumber_Add(__pyx_v_wc, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __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 = 1852; __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 = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_f_len)) { __Pyx_RaiseClosureNameError("f_len"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1863; __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 = 1863; __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 = 1863; __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 = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__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 = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (!__pyx_t_5) {
- __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_v_f_len)) { __Pyx_RaiseClosureNameError("f_len"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_cur_scope->__pyx_v_f_len, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ 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 = 1863; __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 = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (!__pyx_t_6) {
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1853
- * # Phrase extraction limits
- * if wc + len(nt) > self.max_length or (f_j + 1) > f_len or \
- * (f_j - f_i) + 1 > self.max_initial_size: # <<<<<<<<<<<<<<
- * return
- * # Unaligned word
- */
- __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 = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __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 = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1853; __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_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_8 = __pyx_t_7;
- } else {
- __pyx_t_8 = __pyx_t_6;
- }
- __pyx_t_6 = __pyx_t_8;
- } else {
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1863; __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 = 1863; __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 = 1863; __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 = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __pyx_t_5;
+ } else {
+ __pyx_t_6 = __pyx_t_3;
}
if (__pyx_t_6) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1854
- * if wc + len(nt) > self.max_length or (f_j + 1) > f_len or \
- * (f_j - f_i) + 1 > self.max_initial_size:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1864
+ * # Phrase extraction limits
+ * if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size:
* return # <<<<<<<<<<<<<<
* # Unaligned word
* if not al[f_j]:
@@ -57083,168 +57074,214 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(
}
__pyx_L3:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1856
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1866
* return
* # Unaligned word
* if not al[f_j]: # <<<<<<<<<<<<<<
- * # Open non-terminal: extend
- * if nt_open:
+ * # Adjacent to non-terminal: extend (non-terminal now open)
+ * if nt and nt[-1][2] == f_j - 1:
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_al)) { __Pyx_RaiseClosureNameError("al"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_5 = (!__pyx_t_6);
- if (__pyx_t_5) {
+ if (unlikely(!__pyx_cur_scope->__pyx_v_al)) { __Pyx_RaiseClosureNameError("al"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_3 = (!__pyx_t_6);
+ if (__pyx_t_3) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1858
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1868
* if not al[f_j]:
- * # Open non-terminal: extend
- * if nt_open: # <<<<<<<<<<<<<<
+ * # Adjacent to non-terminal: extend (non-terminal now open)
+ * if nt and nt[-1][2] == f_j - 1: # <<<<<<<<<<<<<<
* nt[-1][2] += 1
- * extract(f_i, f_j + 1, e_i, e_j, wc, links, nt, True)
+ * extract(f_i, f_j + 1, e_i, e_j, min_bound, wc, links, nt, True)
*/
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_nt_open); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_3) {
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyNumber_Subtract(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1868; __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_5 = __pyx_t_6;
+ } else {
+ __pyx_t_5 = __pyx_t_3;
+ }
if (__pyx_t_5) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1859
- * # Open non-terminal: extend
- * if nt_open:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1869
+ * # Adjacent to non-terminal: extend (non-terminal now open)
+ * if nt and nt[-1][2] == f_j - 1:
* nt[-1][2] += 1 # <<<<<<<<<<<<<<
- * extract(f_i, f_j + 1, e_i, e_j, wc, links, nt, True)
+ * extract(f_i, f_j + 1, e_i, e_j, min_bound, wc, links, nt, True)
* nt[-1][2] -= 1
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = 2;
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = 2;
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_t_7, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__Pyx_SetItemInt(__pyx_t_3, __pyx_t_1, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __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_3); __pyx_t_3 = 0;
+ if (__Pyx_SetItemInt(__pyx_t_1, __pyx_t_7, __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1860
- * if nt_open:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1870
+ * if nt and nt[-1][2] == f_j - 1:
* nt[-1][2] += 1
- * extract(f_i, f_j + 1, e_i, e_j, wc, links, nt, True) # <<<<<<<<<<<<<<
+ * extract(f_i, f_j + 1, e_i, e_j, min_bound, wc, links, nt, True) # <<<<<<<<<<<<<<
* nt[-1][2] -= 1
- * # No open non-terminal: extend with word
+ * # Unless non-terminal already open, always extend with word
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_3 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyTuple_New(8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1860; __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 = 1870; __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 = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyTuple_New(9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f_i);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f_i);
__Pyx_GIVEREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_e_i);
- PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_e_i);
+ PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_e_i);
__Pyx_GIVEREF(__pyx_v_e_i);
__Pyx_INCREF(__pyx_v_e_j);
- PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_e_j);
+ PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_e_j);
__Pyx_GIVEREF(__pyx_v_e_j);
+ __Pyx_INCREF(__pyx_v_min_bound);
+ PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_min_bound);
+ __Pyx_GIVEREF(__pyx_v_min_bound);
__Pyx_INCREF(__pyx_v_wc);
- PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_wc);
+ PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_wc);
__Pyx_GIVEREF(__pyx_v_wc);
__Pyx_INCREF(__pyx_v_links);
- PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_v_links);
+ PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_v_links);
__Pyx_GIVEREF(__pyx_v_links);
__Pyx_INCREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_v_nt);
+ PyTuple_SET_ITEM(__pyx_t_4, 7, __pyx_v_nt);
__Pyx_GIVEREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_2, 7, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_3 = 0;
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ PyTuple_SET_ITEM(__pyx_t_4, 8, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_1 = 0;
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1861
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1871
* nt[-1][2] += 1
- * extract(f_i, f_j + 1, e_i, e_j, wc, links, nt, True)
+ * extract(f_i, f_j + 1, e_i, e_j, min_bound, wc, links, nt, True)
* nt[-1][2] -= 1 # <<<<<<<<<<<<<<
- * # No open non-terminal: extend with word
- * else:
+ * # Unless non-terminal already open, always extend with word
+ * # Make sure adding a word doesn't exceed length
*/
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = 2;
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__Pyx_SetItemInt(__pyx_t_4, __pyx_t_1, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_7 = 2;
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, __pyx_t_7, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__Pyx_SetItemInt(__pyx_t_2, __pyx_t_7, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1871; __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;
goto __pyx_L5;
}
- /*else*/ {
+ __pyx_L5:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1864
- * # No open non-terminal: extend with word
- * else:
- * extract(f_i, f_j + 1, e_i, e_j, wc + 1, links, nt, False) # <<<<<<<<<<<<<<
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1874
+ * # Unless non-terminal already open, always extend with word
+ * # Make sure adding a word doesn't exceed length
+ * if not nt_open and wc < self.max_length: # <<<<<<<<<<<<<<
+ * extract(f_i, f_j + 1, e_i, e_j, min_bound, wc + 1, links, nt, False)
+ * return
+ */
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_nt_open); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = (!__pyx_t_5);
+ if (__pyx_t_3) {
+ __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 = 1874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_6 = __pyx_t_5;
+ } else {
+ __pyx_t_6 = __pyx_t_3;
+ }
+ if (__pyx_t_6) {
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1875
+ * # Make sure adding a word doesn't exceed length
+ * if not nt_open and wc < self.max_length:
+ * extract(f_i, f_j + 1, e_i, e_j, min_bound, wc + 1, links, nt, False) # <<<<<<<<<<<<<<
* return
* # Aligned word
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1864; __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 = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1864; __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 = 1875; __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 = 1875; __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 = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = PyTuple_New(8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = PyTuple_New(9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__Pyx_INCREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_f_i);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f_i);
__Pyx_GIVEREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_e_i);
- PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_e_i);
+ PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_e_i);
__Pyx_GIVEREF(__pyx_v_e_i);
__Pyx_INCREF(__pyx_v_e_j);
- PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_v_e_j);
+ PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_v_e_j);
__Pyx_GIVEREF(__pyx_v_e_j);
- PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_min_bound);
+ PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_min_bound);
+ __Pyx_GIVEREF(__pyx_v_min_bound);
+ PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_links);
- PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_v_links);
+ PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_v_links);
__Pyx_GIVEREF(__pyx_v_links);
__Pyx_INCREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_v_nt);
+ PyTuple_SET_ITEM(__pyx_t_8, 7, __pyx_v_nt);
__Pyx_GIVEREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_9, 7, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_4 = 0;
- __pyx_t_3 = 0;
+ PyTuple_SET_ITEM(__pyx_t_8, 8, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_1 = 0;
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyObject_Call(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ goto __pyx_L6;
}
- __pyx_L5:;
+ __pyx_L6:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1865
- * else:
- * extract(f_i, f_j + 1, e_i, e_j, wc + 1, links, nt, False)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1876
+ * if not nt_open and wc < self.max_length:
+ * extract(f_i, f_j + 1, e_i, e_j, min_bound, wc + 1, links, nt, False)
* return # <<<<<<<<<<<<<<
* # Aligned word
- * link_i = al_span[f_j][0]
+ * link_i = fe_span[f_j][0]
*/
__Pyx_XDECREF(__pyx_r);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -57253,1783 +57290,1636 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(
}
__pyx_L4:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1867
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1878
* return
* # Aligned word
- * link_i = al_span[f_j][0] # <<<<<<<<<<<<<<
- * link_j = al_span[f_j][1]
+ * link_i = fe_span[f_j][0] # <<<<<<<<<<<<<<
+ * link_j = fe_span[f_j][1]
* new_e_i = min(link_i, e_i)
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_al_span)) { __Pyx_RaiseClosureNameError("al_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al_span, __pyx_v_f_j); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_v_link_i = __pyx_t_9;
- __pyx_t_9 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_fe_span)) { __Pyx_RaiseClosureNameError("fe_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f_j); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_link_i = __pyx_t_8;
+ __pyx_t_8 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1868
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1879
* # Aligned word
- * link_i = al_span[f_j][0]
- * link_j = al_span[f_j][1] # <<<<<<<<<<<<<<
+ * link_i = fe_span[f_j][0]
+ * link_j = fe_span[f_j][1] # <<<<<<<<<<<<<<
* new_e_i = min(link_i, e_i)
* new_e_j = max(link_j, e_j)
*/
- __pyx_t_9 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al_span, __pyx_v_f_j); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_9, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_v_link_j = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_8, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_v_link_j = __pyx_t_4;
+ __pyx_t_4 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1869
- * link_i = al_span[f_j][0]
- * link_j = al_span[f_j][1]
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1880
+ * link_i = fe_span[f_j][0]
+ * link_j = fe_span[f_j][1]
* new_e_i = min(link_i, e_i) # <<<<<<<<<<<<<<
* new_e_j = max(link_j, e_j)
- * # Open non-terminal: close, extract, extend
+ * # Check reverse links of newly covered words to see if they violate left
*/
__Pyx_INCREF(__pyx_v_e_i);
- __pyx_t_2 = __pyx_v_e_i;
+ __pyx_t_4 = __pyx_v_e_i;
__Pyx_INCREF(__pyx_v_link_i);
- __pyx_t_9 = __pyx_v_link_i;
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_9, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __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 = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_5) {
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_3 = __pyx_t_2;
+ __pyx_t_8 = __pyx_v_link_i;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1880; __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 = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_6) {
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_t_2 = __pyx_t_4;
} else {
- __Pyx_INCREF(__pyx_t_9);
- __pyx_t_3 = __pyx_t_9;
+ __Pyx_INCREF(__pyx_t_8);
+ __pyx_t_2 = __pyx_t_8;
}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_v_new_e_i = __pyx_t_2;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_INCREF(__pyx_t_3);
- __pyx_v_new_e_i = __pyx_t_3;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1870
- * link_j = al_span[f_j][1]
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1881
+ * link_j = fe_span[f_j][1]
* new_e_i = min(link_i, e_i)
* new_e_j = max(link_j, e_j) # <<<<<<<<<<<<<<
- * # Open non-terminal: close, extract, extend
- * if nt_open:
+ * # Check reverse links of newly covered words to see if they violate left
+ * # bound (return) or extend minimum right bound for chunk
*/
__Pyx_INCREF(__pyx_v_e_j);
- __pyx_t_3 = __pyx_v_e_j;
+ __pyx_t_2 = __pyx_v_e_j;
__Pyx_INCREF(__pyx_v_link_j);
- __pyx_t_2 = __pyx_v_link_j;
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __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 = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_5) {
- __Pyx_INCREF(__pyx_t_3);
- __pyx_t_9 = __pyx_t_3;
- } else {
+ __pyx_t_4 = __pyx_v_link_j;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1881; __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 = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_6) {
__Pyx_INCREF(__pyx_t_2);
- __pyx_t_9 = __pyx_t_2;
+ __pyx_t_8 = __pyx_t_2;
+ } else {
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_t_8 = __pyx_t_4;
}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_INCREF(__pyx_t_9);
- __pyx_v_new_e_j = __pyx_t_9;
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1872
- * new_e_j = max(link_j, e_j)
- * # Open non-terminal: close, extract, extend
- * if nt_open: # <<<<<<<<<<<<<<
- * # Close non-terminal, checking for collisions
- * old_last_nt = nt[-1][:]
- */
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_nt_open); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_5) {
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1874
- * if nt_open:
- * # Close non-terminal, checking for collisions
- * old_last_nt = nt[-1][:] # <<<<<<<<<<<<<<
- * nt[-1][2] = f_j
- * if link_i < nt[-1][3]:
- */
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_t_9, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_v_old_last_nt = __pyx_t_3;
- __pyx_t_3 = 0;
+ __Pyx_INCREF(__pyx_t_8);
+ __pyx_v_new_e_j = __pyx_t_8;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1875
- * # Close non-terminal, checking for collisions
- * old_last_nt = nt[-1][:]
- * nt[-1][2] = f_j # <<<<<<<<<<<<<<
- * if link_i < nt[-1][3]:
- * if not span_check(cover, link_i, nt[-1][3] - 1):
- */
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (__Pyx_SetItemInt(__pyx_t_3, 2, __pyx_v_f_j, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1884
+ * # Check reverse links of newly covered words to see if they violate left
+ * # bound (return) or extend minimum right bound for chunk
+ * new_min_bound = min_bound # <<<<<<<<<<<<<<
+ * # First aligned word creates span
+ * if e_j == -1:
+ */
+ __Pyx_INCREF(__pyx_v_min_bound);
+ __pyx_v_new_min_bound = __pyx_v_min_bound;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1886
+ * new_min_bound = min_bound
+ * # First aligned word creates span
+ * if e_j == -1: # <<<<<<<<<<<<<<
+ * for i from new_e_i <= i <= new_e_j:
+ * if ef_span[i][0] < f_i:
+ */
+ __pyx_t_8 = PyObject_RichCompare(__pyx_v_e_j, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (__pyx_t_6) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1876
- * old_last_nt = nt[-1][:]
- * nt[-1][2] = f_j
- * if link_i < nt[-1][3]: # <<<<<<<<<<<<<<
- * if not span_check(cover, link_i, nt[-1][3] - 1):
- * nt[-1] = old_last_nt
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1887
+ * # First aligned word creates span
+ * if e_j == -1:
+ * for i from new_e_i <= i <= new_e_j: # <<<<<<<<<<<<<<
+ * if ef_span[i][0] < f_i:
+ * return
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_3, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_9, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_5) {
+ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_new_e_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ for (__pyx_t_11 = __pyx_t_9; __pyx_t_11 <= __pyx_t_10; __pyx_t_11++) {
+ __pyx_t_8 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_v_i);
+ __pyx_v_i = __pyx_t_8;
+ __pyx_t_8 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1877
- * nt[-1][2] = f_j
- * if link_i < nt[-1][3]:
- * if not span_check(cover, link_i, nt[-1][3] - 1): # <<<<<<<<<<<<<<
- * nt[-1] = old_last_nt
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1888
+ * if e_j == -1:
+ * for i from new_e_i <= i <= new_e_j:
+ * if ef_span[i][0] < f_i: # <<<<<<<<<<<<<<
* return
+ * new_min_bound = max(new_min_bound, ef_span[i][1])
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_check); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_9, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_cover);
- __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
- __Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_link_i);
- __Pyx_GIVEREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
- __pyx_t_9 = 0;
- __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_6 = (!__pyx_t_5);
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
if (__pyx_t_6) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1878
- * if link_i < nt[-1][3]:
- * if not span_check(cover, link_i, nt[-1][3] - 1):
- * nt[-1] = old_last_nt # <<<<<<<<<<<<<<
- * return
- * span_flip(cover, link_i, nt[-1][3] - 1)
- */
- if (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1879
- * if not span_check(cover, link_i, nt[-1][3] - 1):
- * nt[-1] = old_last_nt
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1889
+ * for i from new_e_i <= i <= new_e_j:
+ * if ef_span[i][0] < f_i:
* return # <<<<<<<<<<<<<<
- * span_flip(cover, link_i, nt[-1][3] - 1)
- * nt[-1][3] = link_i
+ * new_min_bound = max(new_min_bound, ef_span[i][1])
+ * # Other aligned words extend span
*/
__Pyx_XDECREF(__pyx_r);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
- goto __pyx_L8;
+ goto __pyx_L10;
}
- __pyx_L8:;
+ __pyx_L10:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1880
- * nt[-1] = old_last_nt
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1890
+ * if ef_span[i][0] < f_i:
* return
- * span_flip(cover, link_i, nt[-1][3] - 1) # <<<<<<<<<<<<<<
- * nt[-1][3] = link_i
- * if link_j > nt[-1][4]:
+ * new_min_bound = max(new_min_bound, ef_span[i][1]) # <<<<<<<<<<<<<<
+ * # Other aligned words extend span
+ * else:
*/
- __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_flip); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1880; __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); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1880; __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_3, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_cover);
- __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
- __Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_link_i);
- __Pyx_GIVEREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_INCREF(__pyx_v_new_min_bound);
+ __pyx_t_8 = __pyx_v_new_min_bound;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1890; __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 = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_6) {
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_t_4 = __pyx_t_2;
+ } else {
+ __Pyx_INCREF(__pyx_t_8);
+ __pyx_t_4 = __pyx_t_8;
+ }
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_v_new_min_bound);
+ __pyx_v_new_min_bound = __pyx_t_4;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1881
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1887
+ * # First aligned word creates span
+ * if e_j == -1:
+ * for i from new_e_i <= i <= new_e_j: # <<<<<<<<<<<<<<
+ * if ef_span[i][0] < f_i:
* return
- * span_flip(cover, link_i, nt[-1][3] - 1)
- * nt[-1][3] = link_i # <<<<<<<<<<<<<<
- * if link_j > nt[-1][4]:
- * if not span_check(cover, nt[-1][4] + 1, link_j):
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (__Pyx_SetItemInt(__pyx_t_2, 3, __pyx_v_link_i, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- goto __pyx_L7;
- }
- __pyx_L7:;
+ __pyx_t_4 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_v_i);
+ __pyx_v_i = __pyx_t_4;
+ __pyx_t_4 = 0;
+ goto __pyx_L7;
+ }
+ /*else*/ {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1882
- * span_flip(cover, link_i, nt[-1][3] - 1)
- * nt[-1][3] = link_i
- * if link_j > nt[-1][4]: # <<<<<<<<<<<<<<
- * if not span_check(cover, nt[-1][4] + 1, link_j):
- * nt[-1] = old_last_nt
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1893
+ * # Other aligned words extend span
+ * else:
+ * for i from new_e_i <= i < e_i: # <<<<<<<<<<<<<<
+ * if ef_span[i][0] < f_i:
+ * return
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __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_RichCompare(__pyx_v_link_j, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_6) {
+ __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_new_e_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_e_i); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ for (__pyx_t_9 = __pyx_t_11; __pyx_t_9 < __pyx_t_10; __pyx_t_9++) {
+ __pyx_t_4 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_v_i);
+ __pyx_v_i = __pyx_t_4;
+ __pyx_t_4 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1883
- * nt[-1][3] = link_i
- * if link_j > nt[-1][4]:
- * if not span_check(cover, nt[-1][4] + 1, link_j): # <<<<<<<<<<<<<<
- * nt[-1] = old_last_nt
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1894
+ * else:
+ * for i from new_e_i <= i < e_i:
+ * if ef_span[i][0] < f_i: # <<<<<<<<<<<<<<
* return
+ * new_min_bound = max(new_min_bound, ef_span[i][1])
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_check); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_3, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_cur_scope->__pyx_v_cover);
- __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_link_j);
- __Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_5 = (!__pyx_t_6);
- if (__pyx_t_5) {
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1884
- * if link_j > nt[-1][4]:
- * if not span_check(cover, nt[-1][4] + 1, link_j):
- * nt[-1] = old_last_nt # <<<<<<<<<<<<<<
- * return
- * span_flip(cover, nt[-1][4] + 1, link_j)
- */
- if (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_6) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1885
- * if not span_check(cover, nt[-1][4] + 1, link_j):
- * nt[-1] = old_last_nt
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1895
+ * for i from new_e_i <= i < e_i:
+ * if ef_span[i][0] < f_i:
* return # <<<<<<<<<<<<<<
- * span_flip(cover, nt[-1][4] + 1, link_j)
- * nt[-1][4] = link_j
+ * new_min_bound = max(new_min_bound, ef_span[i][1])
+ * for i from e_j < i <= new_e_j:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
- goto __pyx_L10;
+ goto __pyx_L13;
}
- __pyx_L10:;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1886
- * nt[-1] = old_last_nt
- * return
- * span_flip(cover, nt[-1][4] + 1, link_j) # <<<<<<<<<<<<<<
- * nt[-1][4] = link_j
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
- */
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_flip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_9, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_cover);
- __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
- __Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_link_j);
- __Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_9 = 0;
- __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_L13:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1887
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1896
+ * if ef_span[i][0] < f_i:
* return
- * span_flip(cover, nt[-1][4] + 1, link_j)
- * nt[-1][4] = link_j # <<<<<<<<<<<<<<
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
- * rules.add(rule)
+ * new_min_bound = max(new_min_bound, ef_span[i][1]) # <<<<<<<<<<<<<<
+ * for i from e_j < i <= new_e_j:
+ * if ef_span[i][0] < f_i:
*/
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- if (__Pyx_SetItemInt(__pyx_t_9, 4, __pyx_v_link_j, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- goto __pyx_L9;
- }
- __pyx_L9:;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1888
- * span_flip(cover, nt[-1][4] + 1, link_j)
- * nt[-1][4] = link_j
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links): # <<<<<<<<<<<<<<
- * rules.add(rule)
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False)
- */
- __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__form_rules); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_f_words, __pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_new_e_i); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_e_words, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f_i);
- __Pyx_GIVEREF(__pyx_v_f_i);
- __Pyx_INCREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_new_e_i);
- __Pyx_GIVEREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_nt);
- __Pyx_GIVEREF(__pyx_v_nt);
- __Pyx_INCREF(__pyx_v_links);
- PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_links);
- __Pyx_GIVEREF(__pyx_v_links);
- __pyx_t_2 = 0;
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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_1 = 0;
- __pyx_t_11 = NULL;
- } else {
- __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_11 = Py_TYPE(__pyx_t_4)->tp_iternext;
- }
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- for (;;) {
- if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_4)) {
- if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_4)) {
- if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_INCREF(__pyx_v_new_min_bound);
+ __pyx_t_4 = __pyx_v_new_min_bound;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1896; __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 = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_6) {
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_t_8 = __pyx_t_2;
} else {
- __pyx_t_3 = __pyx_t_11(__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 = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- break;
- }
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_t_8 = __pyx_t_4;
}
- __Pyx_XDECREF(__pyx_v_rule);
- __pyx_v_rule = __pyx_t_3;
- __pyx_t_3 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1889
- * nt[-1][4] = link_j
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
- * rules.add(rule) # <<<<<<<<<<<<<<
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False)
- * nt[-1] = old_last_nt
- */
- if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_3 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_rules, __pyx_n_s__add); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_INCREF(__pyx_v_rule);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_rule);
- __Pyx_GIVEREF(__pyx_v_rule);
- __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_v_new_min_bound);
+ __pyx_v_new_min_bound = __pyx_t_8;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1890
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
- * rules.add(rule)
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False) # <<<<<<<<<<<<<<
- * nt[-1] = old_last_nt
- * if link_i < nt[-1][3]:
- */
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1890; __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 = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = PyTuple_New(8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_INCREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_f_i);
- __Pyx_GIVEREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_new_e_i);
- __Pyx_GIVEREF(__pyx_v_new_e_i);
- __Pyx_INCREF(__pyx_v_new_e_j);
- PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_v_new_e_j);
- __Pyx_GIVEREF(__pyx_v_new_e_j);
- __Pyx_INCREF(__pyx_v_wc);
- PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_v_wc);
- __Pyx_GIVEREF(__pyx_v_wc);
- __Pyx_INCREF(__pyx_v_links);
- PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_v_links);
- __Pyx_GIVEREF(__pyx_v_links);
- __Pyx_INCREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_v_nt);
- __Pyx_GIVEREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_9, 7, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_4 = 0;
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1891
- * rules.add(rule)
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False)
- * nt[-1] = old_last_nt # <<<<<<<<<<<<<<
- * if link_i < nt[-1][3]:
- * span_flip(cover, link_i, nt[-1][3] - 1)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1893
+ * # Other aligned words extend span
+ * else:
+ * for i from new_e_i <= i < e_i: # <<<<<<<<<<<<<<
+ * if ef_span[i][0] < f_i:
+ * return
*/
- if (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_v_i);
+ __pyx_v_i = __pyx_t_8;
+ __pyx_t_8 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1892
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False)
- * nt[-1] = old_last_nt
- * if link_i < nt[-1][3]: # <<<<<<<<<<<<<<
- * span_flip(cover, link_i, nt[-1][3] - 1)
- * if link_j > nt[-1][4]:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1897
+ * return
+ * new_min_bound = max(new_min_bound, ef_span[i][1])
+ * for i from e_j < i <= new_e_j: # <<<<<<<<<<<<<<
+ * if ef_span[i][0] < f_i:
+ * return
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_9, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_5) {
+ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_e_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ for (__pyx_t_11 = __pyx_t_9+1; __pyx_t_11 <= __pyx_t_10; __pyx_t_11++) {
+ __pyx_t_8 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_v_i);
+ __pyx_v_i = __pyx_t_8;
+ __pyx_t_8 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1893
- * nt[-1] = old_last_nt
- * if link_i < nt[-1][3]:
- * span_flip(cover, link_i, nt[-1][3] - 1) # <<<<<<<<<<<<<<
- * if link_j > nt[-1][4]:
- * span_flip(cover, nt[-1][4] + 1, link_j)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1898
+ * new_min_bound = max(new_min_bound, ef_span[i][1])
+ * for i from e_j < i <= new_e_j:
+ * if ef_span[i][0] < f_i: # <<<<<<<<<<<<<<
+ * return
+ * new_min_bound = max(new_min_bound, ef_span[i][1])
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_flip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_9, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = PyNumber_Subtract(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_cover);
- __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
- __Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_link_i);
- __Pyx_GIVEREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
- __pyx_t_9 = 0;
- __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- goto __pyx_L13;
- }
- __pyx_L13:;
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (__pyx_t_6) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1894
- * if link_i < nt[-1][3]:
- * span_flip(cover, link_i, nt[-1][3] - 1)
- * if link_j > nt[-1][4]: # <<<<<<<<<<<<<<
- * span_flip(cover, nt[-1][4] + 1, link_j)
- * return
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1899
+ * for i from e_j < i <= new_e_j:
+ * if ef_span[i][0] < f_i:
+ * return # <<<<<<<<<<<<<<
+ * new_min_bound = max(new_min_bound, ef_span[i][1])
+ * # Extract, extend with word (unless non-terminal open)
*/
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_9, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (__pyx_t_5) {
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ goto __pyx_L16;
+ }
+ __pyx_L16:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1895
- * span_flip(cover, link_i, nt[-1][3] - 1)
- * if link_j > nt[-1][4]:
- * span_flip(cover, nt[-1][4] + 1, link_j) # <<<<<<<<<<<<<<
- * return
- * # No open non-terminal
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1900
+ * if ef_span[i][0] < f_i:
+ * return
+ * new_min_bound = max(new_min_bound, ef_span[i][1]) # <<<<<<<<<<<<<<
+ * # Extract, extend with word (unless non-terminal open)
+ * if not nt_open:
*/
- __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_flip); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_INCREF(__pyx_v_new_min_bound);
+ __pyx_t_8 = __pyx_v_new_min_bound;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1900; __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 = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_6) {
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_t_4 = __pyx_t_2;
+ } else {
+ __Pyx_INCREF(__pyx_t_8);
+ __pyx_t_4 = __pyx_t_8;
+ }
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_cover);
- __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_link_j);
- __Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_v_new_min_bound);
+ __pyx_v_new_min_bound = __pyx_t_4;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- goto __pyx_L14;
+ __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_L14:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1896
- * if link_j > nt[-1][4]:
- * span_flip(cover, nt[-1][4] + 1, link_j)
- * return # <<<<<<<<<<<<<<
- * # No open non-terminal
- * # Extract, extend with word
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
- goto __pyx_L6;
- }
- __pyx_L6:;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1899
- * # No open non-terminal
- * # Extract, extend with word
- * collision = False # <<<<<<<<<<<<<<
- * for link in al[f_j]:
- * if cover[link]:
- */
- __pyx_v_collision = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1900
- * # Extract, extend with word
- * collision = False
- * for link in al[f_j]: # <<<<<<<<<<<<<<
- * if cover[link]:
- * collision = True
- */
- __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
- __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0;
- __pyx_t_11 = NULL;
- } else {
- __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext;
- }
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- for (;;) {
- if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else {
- __pyx_t_4 = __pyx_t_11(__pyx_t_2);
- if (unlikely(!__pyx_t_4)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- break;
- }
- __Pyx_GOTREF(__pyx_t_4);
- }
- __Pyx_XDECREF(__pyx_v_link);
- __pyx_v_link = __pyx_t_4;
- __pyx_t_4 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1901
- * collision = False
- * for link in al[f_j]:
- * if cover[link]: # <<<<<<<<<<<<<<
- * collision = True
- * # Collisions block extraction and extension, but may be okay for
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1897
+ * return
+ * new_min_bound = max(new_min_bound, ef_span[i][1])
+ * for i from e_j < i <= new_e_j: # <<<<<<<<<<<<<<
+ * if ef_span[i][0] < f_i:
+ * return
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_cover, __pyx_v_link); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_5) {
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1902
- * for link in al[f_j]:
- * if cover[link]:
- * collision = True # <<<<<<<<<<<<<<
- * # Collisions block extraction and extension, but may be okay for
- * # continuing non-terminals
- */
- __pyx_v_collision = 1;
- goto __pyx_L17;
- }
- __pyx_L17:;
+ __Pyx_XDECREF(__pyx_v_i);
+ __pyx_v_i = __pyx_t_4;
+ __pyx_t_4 = 0;
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_L7:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1905
- * # Collisions block extraction and extension, but may be okay for
- * # continuing non-terminals
- * if not collision: # <<<<<<<<<<<<<<
- * plus_links = []
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1902
+ * new_min_bound = max(new_min_bound, ef_span[i][1])
+ * # Extract, extend with word (unless non-terminal open)
+ * if not nt_open: # <<<<<<<<<<<<<<
+ * nt_collision = False
* for link in al[f_j]:
*/
- __pyx_t_5 = (!__pyx_v_collision);
- if (__pyx_t_5) {
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_nt_open); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = (!__pyx_t_6);
+ if (__pyx_t_3) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1906
- * # continuing non-terminals
- * if not collision:
- * plus_links = [] # <<<<<<<<<<<<<<
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1903
+ * # Extract, extend with word (unless non-terminal open)
+ * if not nt_open:
+ * nt_collision = False # <<<<<<<<<<<<<<
* for link in al[f_j]:
- * plus_links.append((f_j, link))
+ * if e_nt_cover[link]:
*/
- __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_v_plus_links = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_v_nt_collision = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1907
- * if not collision:
- * plus_links = []
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1904
+ * if not nt_open:
+ * nt_collision = False
* for link in al[f_j]: # <<<<<<<<<<<<<<
- * plus_links.append((f_j, link))
- * cover[link] = ~cover[link]
+ * if e_nt_cover[link]:
+ * nt_collision = True
*/
- __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
- __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
- __pyx_t_11 = NULL;
+ __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
+ __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
+ __pyx_t_12 = NULL;
} else {
- __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_11 = Py_TYPE(__pyx_t_4)->tp_iternext;
+ __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
for (;;) {
- if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_4)) {
- if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_4)) {
- if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_2 = __pyx_t_11(__pyx_t_4);
- if (unlikely(!__pyx_t_2)) {
+ __pyx_t_4 = __pyx_t_12(__pyx_t_2);
+ if (unlikely(!__pyx_t_4)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_4);
}
__Pyx_XDECREF(__pyx_v_link);
- __pyx_v_link = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_v_link = __pyx_t_4;
+ __pyx_t_4 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1908
- * plus_links = []
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1905
+ * nt_collision = False
* for link in al[f_j]:
- * plus_links.append((f_j, link)) # <<<<<<<<<<<<<<
- * cover[link] = ~cover[link]
- * links.append(plus_links)
+ * if e_nt_cover[link]: # <<<<<<<<<<<<<<
+ * nt_collision = True
+ * # Non-terminal collisions block word extraction and extension, but
*/
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_v_f_j);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f_j);
- __Pyx_GIVEREF(__pyx_v_f_j);
- __Pyx_INCREF(__pyx_v_link);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_link);
- __Pyx_GIVEREF(__pyx_v_link);
- __pyx_t_12 = PyList_Append(__pyx_v_plus_links, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_e_nt_cover, __pyx_v_link); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_3) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1909
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1906
* for link in al[f_j]:
- * plus_links.append((f_j, link))
- * cover[link] = ~cover[link] # <<<<<<<<<<<<<<
- * links.append(plus_links)
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
+ * if e_nt_cover[link]:
+ * nt_collision = True # <<<<<<<<<<<<<<
+ * # Non-terminal collisions block word extraction and extension, but
+ * # may be okay for continuing non-terminals
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_cover, __pyx_v_link); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_nt_collision = 1;
+ goto __pyx_L20;
+ }
+ __pyx_L20:;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1909
+ * # Non-terminal collisions block word extraction and extension, but
+ * # may be okay for continuing non-terminals
+ * if not nt_collision and wc < self.max_length: # <<<<<<<<<<<<<<
+ * plus_links = []
+ * for link in al[f_j]:
+ */
+ __pyx_t_3 = (!__pyx_v_nt_collision);
+ if (__pyx_t_3) {
+ __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 = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = PyNumber_Invert(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetItem(__pyx_cur_scope->__pyx_v_cover, __pyx_v_link, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_5 = __pyx_t_6;
+ } else {
+ __pyx_t_5 = __pyx_t_3;
}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_5) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1910
- * plus_links.append((f_j, link))
- * cover[link] = ~cover[link]
- * links.append(plus_links) # <<<<<<<<<<<<<<
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
- * rules.add(rule)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1910
+ * # may be okay for continuing non-terminals
+ * if not nt_collision and wc < self.max_length:
+ * plus_links = [] # <<<<<<<<<<<<<<
+ * for link in al[f_j]:
+ * plus_links.append((f_j, link))
*/
- __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_links, ((PyObject *)__pyx_v_plus_links)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_v_plus_links = __pyx_t_4;
+ __pyx_t_4 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1911
- * cover[link] = ~cover[link]
- * links.append(plus_links)
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links): # <<<<<<<<<<<<<<
- * rules.add(rule)
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc + 1, links, nt, False)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1911
+ * if not nt_collision and wc < self.max_length:
+ * plus_links = []
+ * for link in al[f_j]: # <<<<<<<<<<<<<<
+ * plus_links.append((f_j, link))
+ * cover[link] += 1
*/
- __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__form_rules); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_f_words, __pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_new_e_i); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_e_words, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f_i);
- __Pyx_GIVEREF(__pyx_v_f_i);
- __Pyx_INCREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_new_e_i);
- __Pyx_GIVEREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
- PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_nt);
- __Pyx_GIVEREF(__pyx_v_nt);
- __Pyx_INCREF(__pyx_v_links);
- PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_v_links);
- __Pyx_GIVEREF(__pyx_v_links);
- __pyx_t_9 = 0;
- __pyx_t_2 = 0;
- __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 = 1911; __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;
- if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
- __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
- __pyx_t_11 = NULL;
- } else {
- __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext;
- }
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- for (;;) {
- if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
+ __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
+ __pyx_t_12 = NULL;
} else {
- __pyx_t_2 = __pyx_t_11(__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 = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ for (;;) {
+ if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ __pyx_t_4 = __pyx_t_12(__pyx_t_2);
+ if (unlikely(!__pyx_t_4)) {
+ if (PyErr_Occurred()) {
+ if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ break;
}
- break;
+ __Pyx_GOTREF(__pyx_t_4);
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_v_link);
+ __pyx_v_link = __pyx_t_4;
+ __pyx_t_4 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1912
+ * plus_links = []
+ * for link in al[f_j]:
+ * plus_links.append((f_j, link)) # <<<<<<<<<<<<<<
+ * cover[link] += 1
+ * links.append(plus_links)
+ */
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_v_f_j);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f_j);
+ __Pyx_GIVEREF(__pyx_v_f_j);
+ __Pyx_INCREF(__pyx_v_link);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_link);
+ __Pyx_GIVEREF(__pyx_v_link);
+ __pyx_t_13 = PyList_Append(__pyx_v_plus_links, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1913
+ * for link in al[f_j]:
+ * plus_links.append((f_j, link))
+ * cover[link] += 1 # <<<<<<<<<<<<<<
+ * links.append(plus_links)
+ * if links and f_j >= new_min_bound:
+ */
+ __Pyx_INCREF(__pyx_v_link);
+ __pyx_t_4 = __pyx_v_link;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_cover, __pyx_t_4); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (PyObject_SetItem(__pyx_cur_scope->__pyx_v_cover, __pyx_t_4, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
- __Pyx_XDECREF(__pyx_v_rule);
- __pyx_v_rule = __pyx_t_2;
- __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1912
- * links.append(plus_links)
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
- * rules.add(rule) # <<<<<<<<<<<<<<
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc + 1, links, nt, False)
- * links.pop()
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1914
+ * plus_links.append((f_j, link))
+ * cover[link] += 1
+ * links.append(plus_links) # <<<<<<<<<<<<<<
+ * if links and f_j >= new_min_bound:
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_rules, __pyx_n_s__add); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_links, ((PyObject *)__pyx_v_plus_links)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_v_rule);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_rule);
- __Pyx_GIVEREF(__pyx_v_rule);
- __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- }
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1913
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
- * rules.add(rule)
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc + 1, links, nt, False) # <<<<<<<<<<<<<<
- * links.pop()
- * for link in al[f_j]:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1915
+ * cover[link] += 1
+ * links.append(plus_links)
+ * if links and f_j >= new_min_bound: # <<<<<<<<<<<<<<
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_3 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyTuple_New(8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f_i);
- __Pyx_GIVEREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_new_e_i);
- __Pyx_GIVEREF(__pyx_v_new_e_i);
- __Pyx_INCREF(__pyx_v_new_e_j);
- PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_new_e_j);
- __Pyx_GIVEREF(__pyx_v_new_e_j);
- PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
- __Pyx_INCREF(__pyx_v_links);
- PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_v_links);
- __Pyx_GIVEREF(__pyx_v_links);
- __Pyx_INCREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_v_nt);
- __Pyx_GIVEREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_2, 7, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_3 = 0;
- __pyx_t_9 = 0;
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_5) {
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_f_j, __pyx_v_new_min_bound, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __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 = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_6 = __pyx_t_3;
+ } else {
+ __pyx_t_6 = __pyx_t_5;
+ }
+ if (__pyx_t_6) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1914
- * rules.add(rule)
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc + 1, links, nt, False)
- * links.pop() # <<<<<<<<<<<<<<
- * for link in al[f_j]:
- * cover[link] = ~cover[link]
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1916
+ * links.append(plus_links)
+ * if links and f_j >= new_min_bound:
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links)) # <<<<<<<<<<<<<<
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
+ * links.pop()
*/
- __pyx_t_4 = __Pyx_PyObject_Pop(__pyx_v_links); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_rules, __pyx_n_s__add); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__form_rule); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __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 = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_f_words, __pyx_t_7, __pyx_t_14); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_v_new_e_i); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_e_words, __pyx_t_14, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_15 = PyTuple_New(6); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_INCREF(__pyx_v_f_i);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_f_i);
+ __Pyx_GIVEREF(__pyx_v_f_i);
+ __Pyx_INCREF(__pyx_v_new_e_i);
+ PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_new_e_i);
+ __Pyx_GIVEREF(__pyx_v_new_e_i);
+ PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ __Pyx_INCREF(__pyx_v_nt);
+ PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_v_nt);
+ __Pyx_GIVEREF(__pyx_v_nt);
+ __Pyx_INCREF(__pyx_v_links);
+ PyTuple_SET_ITEM(__pyx_t_15, 5, __pyx_v_links);
+ __Pyx_GIVEREF(__pyx_v_links);
+ __pyx_t_1 = 0;
+ __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
+ __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ goto __pyx_L24;
+ }
+ __pyx_L24:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1915
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc + 1, links, nt, False)
- * links.pop()
- * for link in al[f_j]: # <<<<<<<<<<<<<<
- * cover[link] = ~cover[link]
- * # Try to add a word to a (closed) non-terminal, extract, extend
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1917
+ * if links and f_j >= new_min_bound:
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False) # <<<<<<<<<<<<<<
+ * links.pop()
+ * for link in al[f_j]:
*/
- __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
- __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0;
- __pyx_t_11 = NULL;
- } else {
- __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __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 = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_15 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext;
- }
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- for (;;) {
- if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ __pyx_t_4 = PyTuple_New(9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_v_f_i);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f_i);
+ __Pyx_GIVEREF(__pyx_v_f_i);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ __Pyx_INCREF(__pyx_v_new_e_i);
+ PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_new_e_i);
+ __Pyx_GIVEREF(__pyx_v_new_e_i);
+ __Pyx_INCREF(__pyx_v_new_e_j);
+ PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_new_e_j);
+ __Pyx_GIVEREF(__pyx_v_new_e_j);
+ __Pyx_INCREF(__pyx_v_new_min_bound);
+ PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_new_min_bound);
+ __Pyx_GIVEREF(__pyx_v_new_min_bound);
+ PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __Pyx_INCREF(__pyx_v_links);
+ PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_v_links);
+ __Pyx_GIVEREF(__pyx_v_links);
+ __Pyx_INCREF(__pyx_v_nt);
+ PyTuple_SET_ITEM(__pyx_t_4, 7, __pyx_v_nt);
+ __Pyx_GIVEREF(__pyx_v_nt);
+ PyTuple_SET_ITEM(__pyx_t_4, 8, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_8 = 0;
+ __pyx_t_15 = 0;
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1918
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
+ * links.pop() # <<<<<<<<<<<<<<
+ * for link in al[f_j]:
+ * cover[link] -= 1
+ */
+ __pyx_t_2 = __Pyx_PyObject_Pop(__pyx_v_links); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1919
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
+ * links.pop()
+ * for link in al[f_j]: # <<<<<<<<<<<<<<
+ * cover[link] -= 1
+ * # Try to add a word to current non-terminal (if any), extract, extend
+ */
+ __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
+ __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0;
+ __pyx_t_12 = NULL;
} else {
- __pyx_t_4 = __pyx_t_11(__pyx_t_2);
- if (unlikely(!__pyx_t_4)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- break;
- }
+ __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_12 = Py_TYPE(__pyx_t_4)->tp_iternext;
}
- __Pyx_XDECREF(__pyx_v_link);
- __pyx_v_link = __pyx_t_4;
- __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ for (;;) {
+ if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_4)) {
+ if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_4)) {
+ if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ __pyx_t_2 = __pyx_t_12(__pyx_t_4);
+ if (unlikely(!__pyx_t_2)) {
+ if (PyErr_Occurred()) {
+ if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ }
+ __Pyx_XDECREF(__pyx_v_link);
+ __pyx_v_link = __pyx_t_2;
+ __pyx_t_2 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1916
- * links.pop()
- * for link in al[f_j]:
- * cover[link] = ~cover[link] # <<<<<<<<<<<<<<
- * # Try to add a word to a (closed) non-terminal, extract, extend
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1920
+ * links.pop()
+ * for link in al[f_j]:
+ * cover[link] -= 1 # <<<<<<<<<<<<<<
+ * # Try to add a word to current non-terminal (if any), extract, extend
* if nt and nt[-1][2] == f_j - 1:
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_cover, __pyx_v_link); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = PyNumber_Invert(__pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_INCREF(__pyx_v_link);
+ __pyx_t_2 = __pyx_v_link;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_15 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_cover, __pyx_t_2); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_8 = PyNumber_InPlaceSubtract(__pyx_t_15, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (PyObject_SetItem(__pyx_cur_scope->__pyx_v_cover, __pyx_t_2, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ }
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (PyObject_SetItem(__pyx_cur_scope->__pyx_v_cover, __pyx_v_link, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ goto __pyx_L21;
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- goto __pyx_L18;
+ __pyx_L21:;
+ goto __pyx_L17;
}
- __pyx_L18:;
+ __pyx_L17:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1918
- * cover[link] = ~cover[link]
- * # Try to add a word to a (closed) non-terminal, extract, extend
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1922
+ * cover[link] -= 1
+ * # Try to add a word to current non-terminal (if any), extract, extend
* if nt and nt[-1][2] == f_j - 1: # <<<<<<<<<<<<<<
* # Add to non-terminal, checking for collisions
* old_last_nt = nt[-1][:]
*/
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_5) {
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Subtract(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_6) {
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_9, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyNumber_Subtract(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_8 = __pyx_t_6;
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_3 = __pyx_t_5;
} else {
- __pyx_t_8 = __pyx_t_5;
+ __pyx_t_3 = __pyx_t_6;
}
- if (__pyx_t_8) {
+ if (__pyx_t_3) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1920
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1924
* if nt and nt[-1][2] == f_j - 1:
* # Add to non-terminal, checking for collisions
* old_last_nt = nt[-1][:] # <<<<<<<<<<<<<<
* nt[-1][2] = f_j
* if link_i < nt[-1][3]:
*/
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_t_8, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_t_4, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_v_old_last_nt = __pyx_t_2;
- __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_v_old_last_nt = __pyx_t_4;
+ __pyx_t_4 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1921
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1925
* # Add to non-terminal, checking for collisions
* old_last_nt = nt[-1][:]
* nt[-1][2] = f_j # <<<<<<<<<<<<<<
* if link_i < nt[-1][3]:
* if not span_check(cover, link_i, nt[-1][3] - 1):
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (__Pyx_SetItemInt(__pyx_t_2, 2, __pyx_v_f_j, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (__Pyx_SetItemInt(__pyx_t_4, 2, __pyx_v_f_j, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1922
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1926
* old_last_nt = nt[-1][:]
* nt[-1][2] = f_j
* if link_i < nt[-1][3]: # <<<<<<<<<<<<<<
* if not span_check(cover, link_i, nt[-1][3] - 1):
* nt[-1] = old_last_nt
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_8) {
+ __pyx_t_4 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_3) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1923
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1927
* nt[-1][2] = f_j
* if link_i < nt[-1][3]:
* if not span_check(cover, link_i, nt[-1][3] - 1): # <<<<<<<<<<<<<<
* nt[-1] = old_last_nt
* return
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_check); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_check); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_4, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyNumber_Subtract(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
- __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_5 = (!__pyx_t_8);
- if (__pyx_t_5) {
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_6 = (!__pyx_t_3);
+ if (__pyx_t_6) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1924
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1928
* if link_i < nt[-1][3]:
* if not span_check(cover, link_i, nt[-1][3] - 1):
* nt[-1] = old_last_nt # <<<<<<<<<<<<<<
* return
- * span_flip(cover, link_i, nt[-1][3] - 1)
+ * span_inc(cover, link_i, nt[-1][3] - 1)
*/
- if (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1925
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1929
* if not span_check(cover, link_i, nt[-1][3] - 1):
* nt[-1] = old_last_nt
* return # <<<<<<<<<<<<<<
- * span_flip(cover, link_i, nt[-1][3] - 1)
- * nt[-1][3] = link_i
+ * span_inc(cover, link_i, nt[-1][3] - 1)
+ * span_inc(e_nt_cover, link_i, nt[-1][3] - 1)
*/
__Pyx_XDECREF(__pyx_r);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
- goto __pyx_L27;
+ goto __pyx_L29;
}
- __pyx_L27:;
+ __pyx_L29:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1926
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1930
* nt[-1] = old_last_nt
* return
- * span_flip(cover, link_i, nt[-1][3] - 1) # <<<<<<<<<<<<<<
+ * span_inc(cover, link_i, nt[-1][3] - 1) # <<<<<<<<<<<<<<
+ * span_inc(e_nt_cover, link_i, nt[-1][3] - 1)
* nt[-1][3] = link_i
- * if link_j > nt[-1][4]:
*/
- __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_flip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_9, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_inc); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __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(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
- __pyx_t_9 = 0;
- __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1927
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1931
* return
- * span_flip(cover, link_i, nt[-1][3] - 1)
+ * span_inc(cover, link_i, nt[-1][3] - 1)
+ * span_inc(e_nt_cover, link_i, nt[-1][3] - 1) # <<<<<<<<<<<<<<
+ * nt[-1][3] = link_i
+ * if link_j > nt[-1][4]:
+ */
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_inc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyNumber_Subtract(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_e_nt_cover);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
+ __Pyx_INCREF(__pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_link_i);
+ __Pyx_GIVEREF(__pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1932
+ * span_inc(cover, link_i, nt[-1][3] - 1)
+ * span_inc(e_nt_cover, link_i, nt[-1][3] - 1)
* nt[-1][3] = link_i # <<<<<<<<<<<<<<
* if link_j > nt[-1][4]:
* if not span_check(cover, nt[-1][4] + 1, link_j):
*/
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- if (__Pyx_SetItemInt(__pyx_t_9, 3, __pyx_v_link_i, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- goto __pyx_L26;
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (__Pyx_SetItemInt(__pyx_t_4, 3, __pyx_v_link_i, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ goto __pyx_L28;
}
- __pyx_L26:;
+ __pyx_L28:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1928
- * span_flip(cover, link_i, nt[-1][3] - 1)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1933
+ * span_inc(e_nt_cover, link_i, nt[-1][3] - 1)
* nt[-1][3] = link_i
* if link_j > nt[-1][4]: # <<<<<<<<<<<<<<
* if not span_check(cover, nt[-1][4] + 1, link_j):
* nt[-1] = old_last_nt
*/
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_9, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (__pyx_t_5) {
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_6) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1929
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1934
* nt[-1][3] = link_i
* if link_j > nt[-1][4]:
* if not span_check(cover, nt[-1][4] + 1, link_j): # <<<<<<<<<<<<<<
* nt[-1] = old_last_nt
* return
*/
- __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_check); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_check); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __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(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_8 = (!__pyx_t_5);
- if (__pyx_t_8) {
+ __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_3 = (!__pyx_t_6);
+ if (__pyx_t_3) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1930
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1935
* if link_j > nt[-1][4]:
* if not span_check(cover, nt[-1][4] + 1, link_j):
* nt[-1] = old_last_nt # <<<<<<<<<<<<<<
* return
- * span_flip(cover, nt[-1][4] + 1, link_j)
+ * span_inc(cover, nt[-1][4] + 1, link_j)
*/
- if (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1931
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1936
* if not span_check(cover, nt[-1][4] + 1, link_j):
* nt[-1] = old_last_nt
* return # <<<<<<<<<<<<<<
- * span_flip(cover, nt[-1][4] + 1, link_j)
- * nt[-1][4] = link_j
+ * span_inc(cover, nt[-1][4] + 1, link_j)
+ * span_inc(e_nt_cover, nt[-1][4] + 1, link_j)
*/
__Pyx_XDECREF(__pyx_r);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
- goto __pyx_L29;
+ goto __pyx_L31;
}
- __pyx_L29:;
+ __pyx_L31:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1932
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1937
* nt[-1] = old_last_nt
* return
- * span_flip(cover, nt[-1][4] + 1, link_j) # <<<<<<<<<<<<<<
+ * span_inc(cover, nt[-1][4] + 1, link_j) # <<<<<<<<<<<<<<
+ * span_inc(e_nt_cover, nt[-1][4] + 1, link_j)
* nt[-1][4] = link_j
- * # Require at least one word in phrase
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_flip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_inc); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __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 = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_link_j);
+ __Pyx_GIVEREF(__pyx_v_link_j);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1938
+ * return
+ * span_inc(cover, nt[-1][4] + 1, link_j)
+ * span_inc(e_nt_cover, nt[-1][4] + 1, link_j) # <<<<<<<<<<<<<<
+ * nt[-1][4] = link_j
+ * if links and f_j >= new_min_bound:
+ */
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_inc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyNumber_Add(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_e_nt_cover);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1933
- * return
- * span_flip(cover, nt[-1][4] + 1, link_j)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1939
+ * span_inc(cover, nt[-1][4] + 1, link_j)
+ * span_inc(e_nt_cover, nt[-1][4] + 1, link_j)
* nt[-1][4] = link_j # <<<<<<<<<<<<<<
- * # Require at least one word in phrase
- * if links:
+ * if links and f_j >= new_min_bound:
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
*/
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (__Pyx_SetItemInt(__pyx_t_4, 4, __pyx_v_link_j, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_t_4, 4, __pyx_v_link_j, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- goto __pyx_L28;
+ goto __pyx_L30;
}
- __pyx_L28:;
+ __pyx_L30:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1935
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1940
+ * span_inc(e_nt_cover, nt[-1][4] + 1, link_j)
* nt[-1][4] = link_j
- * # Require at least one word in phrase
- * if links: # <<<<<<<<<<<<<<
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
- * rules.add(rule)
+ * if links and f_j >= new_min_bound: # <<<<<<<<<<<<<<
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc, links, nt, False)
*/
- __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_8) {
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_3) {
+ __pyx_t_4 = PyObject_RichCompare(__pyx_v_f_j, __pyx_v_new_min_bound, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_5 = __pyx_t_6;
+ } else {
+ __pyx_t_5 = __pyx_t_3;
+ }
+ if (__pyx_t_5) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1936
- * # Require at least one word in phrase
- * if links:
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links): # <<<<<<<<<<<<<<
- * rules.add(rule)
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1941
+ * nt[-1][4] = link_j
+ * if links and f_j >= new_min_bound:
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links)) # <<<<<<<<<<<<<<
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc, links, nt, False)
+ * nt[-1] = old_last_nt
*/
- __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__form_rules); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_4 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_rules, __pyx_n_s__add); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_f_words, __pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_new_e_i); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__form_rule); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_e_words, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_f_words, __pyx_t_7, __pyx_t_14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_v_new_e_i); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_15); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_e_words, __pyx_t_14, __pyx_t_7); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f_i);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_f_i);
__Pyx_GIVEREF(__pyx_v_f_i);
__Pyx_INCREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_new_e_i);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_new_e_i);
__Pyx_GIVEREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
- PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
__Pyx_INCREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_nt);
+ PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_nt);
__Pyx_GIVEREF(__pyx_v_nt);
__Pyx_INCREF(__pyx_v_links);
- PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_v_links);
+ PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_v_links);
__Pyx_GIVEREF(__pyx_v_links);
- __pyx_t_9 = 0;
__pyx_t_2 = 0;
- __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 = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_15 = 0;
+ __pyx_t_15 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(((PyObject *)__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 = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
+ __pyx_t_15 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
- __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
- __pyx_t_11 = NULL;
- } else {
- __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext;
- }
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- for (;;) {
- if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else {
- __pyx_t_2 = __pyx_t_11(__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 = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- break;
- }
- __Pyx_GOTREF(__pyx_t_2);
- }
- __Pyx_XDECREF(__pyx_v_rule);
- __pyx_v_rule = __pyx_t_2;
- __pyx_t_2 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1937
- * if links:
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
- * rules.add(rule) # <<<<<<<<<<<<<<
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False)
- * nt[-1] = old_last_nt
- */
- if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_rules, __pyx_n_s__add); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_v_rule);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_rule);
- __Pyx_GIVEREF(__pyx_v_rule);
- __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- }
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- goto __pyx_L30;
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ goto __pyx_L32;
}
- __pyx_L30:;
+ __pyx_L32:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1938
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
- * rules.add(rule)
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False) # <<<<<<<<<<<<<<
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1942
+ * if links and f_j >= new_min_bound:
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc, links, nt, False) # <<<<<<<<<<<<<<
* nt[-1] = old_last_nt
- * if new_e_i < nt[-1][3]:
+ * if link_i < nt[-1][3]:
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_3 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_4 = PyTuple_New(8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __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 = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_15 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = PyTuple_New(9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_f_i);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f_i);
__Pyx_GIVEREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
__Pyx_INCREF(__pyx_v_new_e_i);
PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_new_e_i);
__Pyx_GIVEREF(__pyx_v_new_e_i);
__Pyx_INCREF(__pyx_v_new_e_j);
PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_new_e_j);
__Pyx_GIVEREF(__pyx_v_new_e_j);
+ __Pyx_INCREF(__pyx_v_new_min_bound);
+ PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_new_min_bound);
+ __Pyx_GIVEREF(__pyx_v_new_min_bound);
__Pyx_INCREF(__pyx_v_wc);
- PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_wc);
+ PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_wc);
__Pyx_GIVEREF(__pyx_v_wc);
__Pyx_INCREF(__pyx_v_links);
- PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_links);
+ PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_v_links);
__Pyx_GIVEREF(__pyx_v_links);
__Pyx_INCREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_v_nt);
+ PyTuple_SET_ITEM(__pyx_t_4, 7, __pyx_v_nt);
__Pyx_GIVEREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_4, 7, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
- __pyx_t_3 = 0;
- __pyx_t_9 = 0;
- __pyx_t_9 = PyObject_Call(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ PyTuple_SET_ITEM(__pyx_t_4, 8, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_15 = 0;
+ __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_Call(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1939
- * rules.add(rule)
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1943
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc, links, nt, False)
* nt[-1] = old_last_nt # <<<<<<<<<<<<<<
- * if new_e_i < nt[-1][3]:
- * span_flip(cover, link_i, nt[-1][3] - 1)
+ * if link_i < nt[-1][3]:
+ * span_dec(cover, link_i, nt[-1][3] - 1)
*/
- if (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1940
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1944
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc, links, nt, False)
* nt[-1] = old_last_nt
- * if new_e_i < nt[-1][3]: # <<<<<<<<<<<<<<
- * span_flip(cover, link_i, nt[-1][3] - 1)
- * if link_j > nt[-1][4]:
+ * if link_i < nt[-1][3]: # <<<<<<<<<<<<<<
+ * span_dec(cover, link_i, nt[-1][3] - 1)
+ * span_dec(e_nt_cover, link_i, nt[-1][3] - 1)
*/
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_9, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = PyObject_RichCompare(__pyx_v_new_e_i, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (__pyx_t_8) {
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_5) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1941
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1945
* nt[-1] = old_last_nt
- * if new_e_i < nt[-1][3]:
- * span_flip(cover, link_i, nt[-1][3] - 1) # <<<<<<<<<<<<<<
+ * if link_i < nt[-1][3]:
+ * span_dec(cover, link_i, nt[-1][3] - 1) # <<<<<<<<<<<<<<
+ * span_dec(e_nt_cover, link_i, nt[-1][3] - 1)
* if link_j > nt[-1][4]:
- * span_flip(cover, nt[-1][4] + 1, link_j)
*/
- __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_flip); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_dec); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_4, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Subtract(__pyx_t_15, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __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(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1946
+ * if link_i < nt[-1][3]:
+ * span_dec(cover, link_i, nt[-1][3] - 1)
+ * span_dec(e_nt_cover, link_i, nt[-1][3] - 1) # <<<<<<<<<<<<<<
+ * if link_j > nt[-1][4]:
+ * span_dec(cover, nt[-1][4] + 1, link_j)
+ */
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_dec); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_15, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_e_nt_cover);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
+ __Pyx_INCREF(__pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_link_i);
+ __Pyx_GIVEREF(__pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
+ __pyx_t_15 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
goto __pyx_L33;
}
__pyx_L33:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1942
- * if new_e_i < nt[-1][3]:
- * span_flip(cover, link_i, nt[-1][3] - 1)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1947
+ * span_dec(cover, link_i, nt[-1][3] - 1)
+ * span_dec(e_nt_cover, link_i, nt[-1][3] - 1)
* if link_j > nt[-1][4]: # <<<<<<<<<<<<<<
- * span_flip(cover, nt[-1][4] + 1, link_j)
- * # Try to start a new non-terminal, extract, extend
+ * span_dec(cover, nt[-1][4] + 1, link_j)
+ * span_dec(e_nt_cover, nt[-1][4] + 1, link_j)
*/
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_8) {
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_15, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ if (__pyx_t_5) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1943
- * span_flip(cover, link_i, nt[-1][3] - 1)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1948
+ * span_dec(e_nt_cover, link_i, nt[-1][3] - 1)
* if link_j > nt[-1][4]:
- * span_flip(cover, nt[-1][4] + 1, link_j) # <<<<<<<<<<<<<<
+ * span_dec(cover, nt[-1][4] + 1, link_j) # <<<<<<<<<<<<<<
+ * span_dec(e_nt_cover, nt[-1][4] + 1, link_j)
* # Try to start a new non-terminal, extract, extend
- * if (not nt or f_j - nt[-1][2] > 1) and len(nt) < self.max_nonterminals:
*/
- __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_flip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_dec); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_3, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1949
+ * if link_j > nt[-1][4]:
+ * span_dec(cover, nt[-1][4] + 1, link_j)
+ * span_dec(e_nt_cover, nt[-1][4] + 1, link_j) # <<<<<<<<<<<<<<
+ * # Try to start a new non-terminal, extract, extend
+ * if (not nt or f_j - nt[-1][2] > 1) and wc < self.max_length and len(nt) < self.max_nonterminals:
+ */
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_dec); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyNumber_Add(__pyx_t_15, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_cur_scope->__pyx_v_e_nt_cover);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_link_j);
+ __Pyx_GIVEREF(__pyx_v_link_j);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L34;
}
__pyx_L34:;
- goto __pyx_L25;
+ goto __pyx_L27;
}
- __pyx_L25:;
+ __pyx_L27:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1945
- * span_flip(cover, nt[-1][4] + 1, link_j)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1951
+ * span_dec(e_nt_cover, nt[-1][4] + 1, link_j)
* # Try to start a new non-terminal, extract, extend
- * if (not nt or f_j - nt[-1][2] > 1) and len(nt) < self.max_nonterminals: # <<<<<<<<<<<<<<
+ * if (not nt or f_j - nt[-1][2] > 1) and wc < self.max_length and len(nt) < self.max_nonterminals: # <<<<<<<<<<<<<<
* # Check for collisions
* if not span_check(cover, link_i, link_j):
*/
- __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_5 = (!__pyx_t_8);
- if (!__pyx_t_5) {
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_3, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Subtract(__pyx_v_f_j, __pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = PyObject_RichCompare(__pyx_t_3, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_6 = __pyx_t_8;
- } else {
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = (!__pyx_t_5);
+ if (!__pyx_t_3) {
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_4, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyNumber_Subtract(__pyx_v_f_j, __pyx_t_15); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyObject_RichCompare(__pyx_t_4, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_t_6 = __pyx_t_5;
+ } else {
+ __pyx_t_6 = __pyx_t_3;
}
if (__pyx_t_6) {
- __pyx_t_1 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_5 = (__pyx_t_1 < __pyx_cur_scope->__pyx_v_self->max_nonterminals);
- __pyx_t_8 = __pyx_t_5;
+ __pyx_t_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_15, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_3) {
+ __pyx_t_7 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = (__pyx_t_7 < __pyx_cur_scope->__pyx_v_self->max_nonterminals);
+ __pyx_t_16 = __pyx_t_5;
+ } else {
+ __pyx_t_16 = __pyx_t_3;
+ }
+ __pyx_t_3 = __pyx_t_16;
} else {
- __pyx_t_8 = __pyx_t_6;
+ __pyx_t_3 = __pyx_t_6;
}
- if (__pyx_t_8) {
+ if (__pyx_t_3) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1947
- * if (not nt or f_j - nt[-1][2] > 1) and len(nt) < self.max_nonterminals:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1953
+ * if (not nt or f_j - nt[-1][2] > 1) and wc < self.max_length and len(nt) < self.max_nonterminals:
* # Check for collisions
* if not span_check(cover, link_i, link_j): # <<<<<<<<<<<<<<
* return
- * span_flip(cover, link_i, link_j)
+ * span_inc(cover, link_i, link_j)
*/
- __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_check); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __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 = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_check); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = (!__pyx_t_8);
+ __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_6 = (!__pyx_t_3);
if (__pyx_t_6) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1948
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1954
* # Check for collisions
* if not span_check(cover, link_i, link_j):
* return # <<<<<<<<<<<<<<
- * span_flip(cover, link_i, link_j)
- * nt.append([(nt[-1][0] + 1) if nt else 1, f_j, f_j, link_i, link_j])
+ * span_inc(cover, link_i, link_j)
+ * span_inc(e_nt_cover, link_i, link_j)
*/
__Pyx_XDECREF(__pyx_r);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -59038,113 +58928,151 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(
}
__pyx_L36:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1949
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1955
* if not span_check(cover, link_i, link_j):
* return
- * span_flip(cover, link_i, link_j) # <<<<<<<<<<<<<<
+ * span_inc(cover, link_i, link_j) # <<<<<<<<<<<<<<
+ * span_inc(e_nt_cover, link_i, link_j)
* nt.append([(nt[-1][0] + 1) if nt else 1, f_j, f_j, link_i, link_j])
- * # Require at least one word in phrase
*/
- __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_flip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_inc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1950
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1956
* return
- * span_flip(cover, link_i, link_j)
+ * span_inc(cover, link_i, link_j)
+ * span_inc(e_nt_cover, link_i, link_j) # <<<<<<<<<<<<<<
+ * nt.append([(nt[-1][0] + 1) if nt else 1, f_j, f_j, link_i, link_j])
+ * # Require at least one word in phrase
+ */
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_inc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_cur_scope->__pyx_v_e_nt_cover);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
+ __Pyx_INCREF(__pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_link_i);
+ __Pyx_GIVEREF(__pyx_v_link_i);
+ __Pyx_INCREF(__pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_link_j);
+ __Pyx_GIVEREF(__pyx_v_link_j);
+ __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1957
+ * span_inc(cover, link_i, link_j)
+ * span_inc(e_nt_cover, link_i, link_j)
* nt.append([(nt[-1][0] + 1) if nt else 1, f_j, f_j, link_i, link_j]) # <<<<<<<<<<<<<<
* # Require at least one word in phrase
- * if links:
+ * if links and f_j >= new_min_bound:
*/
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_6) {
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_15, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_9 = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_1 = __pyx_t_15;
+ __pyx_t_15 = 0;
} else {
__Pyx_INCREF(__pyx_int_1);
- __pyx_t_9 = __pyx_int_1;
+ __pyx_t_1 = __pyx_int_1;
}
- __pyx_t_3 = PyList_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
+ __pyx_t_15 = PyList_New(5); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ PyList_SET_ITEM(__pyx_t_15, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_f_j);
- PyList_SET_ITEM(__pyx_t_3, 1, __pyx_v_f_j);
+ PyList_SET_ITEM(__pyx_t_15, 1, __pyx_v_f_j);
__Pyx_GIVEREF(__pyx_v_f_j);
__Pyx_INCREF(__pyx_v_f_j);
- PyList_SET_ITEM(__pyx_t_3, 2, __pyx_v_f_j);
+ PyList_SET_ITEM(__pyx_t_15, 2, __pyx_v_f_j);
__Pyx_GIVEREF(__pyx_v_f_j);
__Pyx_INCREF(__pyx_v_link_i);
- PyList_SET_ITEM(__pyx_t_3, 3, __pyx_v_link_i);
+ PyList_SET_ITEM(__pyx_t_15, 3, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
__Pyx_INCREF(__pyx_v_link_j);
- PyList_SET_ITEM(__pyx_t_3, 4, __pyx_v_link_j);
+ PyList_SET_ITEM(__pyx_t_15, 4, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_9 = 0;
- __pyx_t_9 = __Pyx_PyObject_Append(__pyx_v_nt, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_nt, ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1952
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1959
* nt.append([(nt[-1][0] + 1) if nt else 1, f_j, f_j, link_i, link_j])
* # Require at least one word in phrase
- * if links: # <<<<<<<<<<<<<<
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
- * rules.add(rule)
+ * if links and f_j >= new_min_bound: # <<<<<<<<<<<<<<
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
*/
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_6) {
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_f_j, __pyx_v_new_min_bound, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1959; __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 = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_16 = __pyx_t_3;
+ } else {
+ __pyx_t_16 = __pyx_t_6;
+ }
+ if (__pyx_t_16) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1953
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1960
* # Require at least one word in phrase
- * if links:
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links): # <<<<<<<<<<<<<<
- * rules.add(rule)
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False)
+ * if links and f_j >= new_min_bound:
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links)) # <<<<<<<<<<<<<<
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
+ * nt.pop()
*/
- __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__form_rules); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_f_words, __pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_new_e_i); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_1 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_rules, __pyx_n_s__add); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_15 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__form_rule); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __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 = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_e_words, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_f_words, __pyx_t_7, __pyx_t_14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_v_new_e_i); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_cur_scope->__pyx_v_e_words, __pyx_t_14, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_f_i);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f_i);
@@ -59152,166 +59080,146 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(
__Pyx_INCREF(__pyx_v_new_e_i);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_new_e_i);
__Pyx_GIVEREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
__Pyx_INCREF(__pyx_v_nt);
PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_nt);
__Pyx_GIVEREF(__pyx_v_nt);
__Pyx_INCREF(__pyx_v_links);
PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_v_links);
__Pyx_GIVEREF(__pyx_v_links);
- __pyx_t_3 = 0;
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
- __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0;
- __pyx_t_11 = NULL;
- } else {
- __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext;
- }
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- for (;;) {
- if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else {
- __pyx_t_4 = __pyx_t_11(__pyx_t_2);
- if (unlikely(!__pyx_t_4)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- break;
- }
- __Pyx_GOTREF(__pyx_t_4);
- }
- __Pyx_XDECREF(__pyx_v_rule);
- __pyx_v_rule = __pyx_t_4;
- __pyx_t_4 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1954
- * if links:
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
- * rules.add(rule) # <<<<<<<<<<<<<<
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False)
- * nt.pop()
- */
- if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_4 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_rules, __pyx_n_s__add); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_INCREF(__pyx_v_rule);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_rule);
- __Pyx_GIVEREF(__pyx_v_rule);
- __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- }
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L37;
}
__pyx_L37:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1955
- * for rule in self.form_rules(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links):
- * rules.add(rule)
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False) # <<<<<<<<<<<<<<
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1961
+ * if links and f_j >= new_min_bound:
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False) # <<<<<<<<<<<<<<
* nt.pop()
- * span_flip(cover, link_i, link_j)
+ * span_dec(cover, link_i, link_j)
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __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 = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_2 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = PyTuple_New(8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_15 = PyTuple_New(9); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_INCREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_f_i);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_f_i);
__Pyx_GIVEREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
__Pyx_INCREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_new_e_i);
+ PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_new_e_i);
__Pyx_GIVEREF(__pyx_v_new_e_i);
__Pyx_INCREF(__pyx_v_new_e_j);
- PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_v_new_e_j);
+ PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_v_new_e_j);
__Pyx_GIVEREF(__pyx_v_new_e_j);
- __Pyx_INCREF(__pyx_v_wc);
- PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_v_wc);
- __Pyx_GIVEREF(__pyx_v_wc);
+ __Pyx_INCREF(__pyx_v_new_min_bound);
+ PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_v_new_min_bound);
+ __Pyx_GIVEREF(__pyx_v_new_min_bound);
+ PyTuple_SET_ITEM(__pyx_t_15, 5, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_links);
- PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_v_links);
+ PyTuple_SET_ITEM(__pyx_t_15, 6, __pyx_v_links);
__Pyx_GIVEREF(__pyx_v_links);
__Pyx_INCREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_v_nt);
+ PyTuple_SET_ITEM(__pyx_t_15, 7, __pyx_v_nt);
__Pyx_GIVEREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_9, 7, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_15, 8, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_8 = 0;
__pyx_t_2 = 0;
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_Call(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1956
- * rules.add(rule)
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1962
+ * rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
* nt.pop() # <<<<<<<<<<<<<<
- * span_flip(cover, link_i, link_j)
- *
+ * span_dec(cover, link_i, link_j)
+ * span_dec(e_nt_cover, link_i, link_j)
*/
- __pyx_t_3 = __Pyx_PyObject_Pop(__pyx_v_nt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Pop(__pyx_v_nt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1957
- * extract(f_i, f_j + 1, new_e_i, new_e_j, wc, links, nt, False)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1963
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
* nt.pop()
- * span_flip(cover, link_i, link_j) # <<<<<<<<<<<<<<
+ * span_dec(cover, link_i, link_j) # <<<<<<<<<<<<<<
+ * span_dec(e_nt_cover, link_i, link_j)
*
- * # Try to extract phrases from every f index
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_flip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_dec); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1964
+ * nt.pop()
+ * span_dec(cover, link_i, link_j)
+ * span_dec(e_nt_cover, link_i, link_j) # <<<<<<<<<<<<<<
+ *
+ * # Try to extract phrases from every f index
+ */
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__span_dec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_cur_scope->__pyx_v_e_nt_cover);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
+ __Pyx_INCREF(__pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_link_i);
+ __Pyx_GIVEREF(__pyx_v_link_i);
+ __Pyx_INCREF(__pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_link_j);
+ __Pyx_GIVEREF(__pyx_v_link_j);
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __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_15)); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L35;
}
__pyx_L35:;
@@ -59319,10 +59227,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_15);
__Pyx_AddTraceback("_sa.HieroCachingRuleFactory.add_instance.extract", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -59330,10 +59239,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(
__Pyx_XDECREF(__pyx_v_link_j);
__Pyx_XDECREF(__pyx_v_new_e_i);
__Pyx_XDECREF(__pyx_v_new_e_j);
- __Pyx_XDECREF(__pyx_v_old_last_nt);
- __Pyx_XDECREF(__pyx_v_rule);
+ __Pyx_XDECREF(__pyx_v_new_min_bound);
+ __Pyx_XDECREF(__pyx_v_i);
__Pyx_XDECREF(__pyx_v_link);
__Pyx_XDECREF(__pyx_v_plus_links);
+ __Pyx_XDECREF(__pyx_v_old_last_nt);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -59352,10 +59262,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
PyObject *__pyx_v_e_len = NULL;
PyObject *__pyx_v_f = NULL;
PyObject *__pyx_v_e = NULL;
- PyObject *__pyx_v_f_i = NULL;
+ CYTHON_UNUSED PyObject *__pyx_v_f_nt_cover = NULL;
+ long __pyx_v_f_i;
PyObject *__pyx_v_rule = NULL;
- PyObject *__pyx_v_f_set = NULL;
- PyObject *__pyx_v_e_set = NULL;
PyObject *__pyx_v_f_ph = NULL;
PyObject *__pyx_v_e_ph = NULL;
PyObject *__pyx_v_e_w = NULL;
@@ -59372,11 +59281,13 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
PyObject *__pyx_t_7 = NULL;
PyObject *(*__pyx_t_8)(PyObject *);
int __pyx_t_9;
- int __pyx_t_10;
- PyObject *__pyx_t_11 = NULL;
- int __pyx_t_12;
- Py_ssize_t __pyx_t_13;
- PyObject *(*__pyx_t_14)(PyObject *);
+ long __pyx_t_10;
+ int __pyx_t_11;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
+ Py_ssize_t __pyx_t_15;
+ PyObject *(*__pyx_t_16)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -59397,20 +59308,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_words);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_words);
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1832
- *
- * # Rules extracted from this instance
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1836
+ * # span more than once.
+ * # (f, e, al, lex_f_i, lex_f_j)
* rules = set() # <<<<<<<<<<<<<<
*
* f_len = len(f_words)
*/
- __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1832; __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 = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_cur_scope->__pyx_v_rules = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1834
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1838
* rules = set()
*
* f_len = len(f_words) # <<<<<<<<<<<<<<
@@ -59419,15 +59330,15 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
*/
__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 = 1834; __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 = 1838; __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 = 1834; __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 = 1838; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":1835
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1839
*
* f_len = len(f_words)
* e_len = len(e_words) # <<<<<<<<<<<<<<
@@ -59436,35 +59347,35 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
*/
__pyx_t_1 = __pyx_cur_scope->__pyx_v_e_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 = 1835; __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 = 1839; __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 = 1835; __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 = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_e_len = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1838
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1842
*
* # Pre-compute alignment info
* al = [[] for i in range(f_len)] # <<<<<<<<<<<<<<
- * al_span = [[f_len + 1, -1] for i in range(f_len)]
- * for (f, e) in alignment:
+ * fe_span = [[e_len + 1, -1] for i in range(f_len)]
+ * ef_span = [[f_len + 1, -1] for i in range(e_len)]
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1842; __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 = 1838; __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 = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_len);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_f_len);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_len);
- __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 = 1838; __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 = 1842; __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 = 1838; __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 = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
@@ -59473,23 +59384,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
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 = 1838; __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 = 1842; __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 = 1838; __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 = 1842; __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 = 1838; __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 = 1842; __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 = 1838; __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 = 1842; __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 = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -59498,9 +59409,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
__Pyx_XDECREF(__pyx_v_i);
__pyx_v_i = __pyx_t_4;
__pyx_t_4 = 0;
- __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -59509,28 +59420,28 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
__pyx_cur_scope->__pyx_v_al = ((PyObject *)__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1839
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1843
* # Pre-compute alignment info
* al = [[] for i in range(f_len)]
- * al_span = [[f_len + 1, -1] for i in range(f_len)] # <<<<<<<<<<<<<<
+ * fe_span = [[e_len + 1, -1] for i in range(f_len)] # <<<<<<<<<<<<<<
+ * ef_span = [[f_len + 1, -1] for i in range(e_len)]
* for (f, e) in alignment:
- * al[f].append(e)
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1843; __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 = 1839; __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 = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_len);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_f_len);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_len);
- __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 = 1839; __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 = 1843; __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 = 1839; __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 = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
@@ -59539,23 +59450,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
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 = 1839; __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 = 1843; __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 = 1839; __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 = 1843; __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 = 1839; __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 = 1843; __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 = 1839; __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 = 1843; __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 = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -59564,9 +59475,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
__Pyx_XDECREF(__pyx_v_i);
__pyx_v_i = __pyx_t_4;
__pyx_t_4 = 0;
- __pyx_t_4 = PyNumber_Add(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Add(__pyx_v_e_len, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
@@ -59574,27 +59485,101 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
PyList_SET_ITEM(__pyx_t_6, 1, __pyx_int_neg_1);
__Pyx_GIVEREF(__pyx_int_neg_1);
__pyx_t_4 = 0;
- if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_INCREF(((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __pyx_cur_scope->__pyx_v_al_span = ((PyObject *)__pyx_t_1);
+ __pyx_cur_scope->__pyx_v_fe_span = ((PyObject *)__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1840
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1844
* al = [[] for i in range(f_len)]
- * al_span = [[f_len + 1, -1] for i in range(f_len)]
+ * fe_span = [[e_len + 1, -1] for i in range(f_len)]
+ * ef_span = [[f_len + 1, -1] for i in range(e_len)] # <<<<<<<<<<<<<<
+ * for (f, e) in alignment:
+ * al[f].append(e)
+ */
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1844; __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 = 1844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_e_len);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_e_len);
+ __Pyx_GIVEREF(__pyx_v_e_len);
+ __pyx_t_6 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
+ __pyx_t_3 = __pyx_t_6; __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_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ for (;;) {
+ 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_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1844; __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_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ __pyx_t_6 = __pyx_t_5(__pyx_t_3);
+ if (unlikely(!__pyx_t_6)) {
+ if (PyErr_Occurred()) {
+ if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_6);
+ }
+ __Pyx_XDECREF(__pyx_v_i);
+ __pyx_v_i = __pyx_t_6;
+ __pyx_t_6 = 0;
+ __pyx_t_6 = PyNumber_Add(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_int_neg_1);
+ PyList_SET_ITEM(__pyx_t_4, 1, __pyx_int_neg_1);
+ __Pyx_GIVEREF(__pyx_int_neg_1);
+ __pyx_t_6 = 0;
+ if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_INCREF(((PyObject *)__pyx_t_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ __pyx_cur_scope->__pyx_v_ef_span = ((PyObject *)__pyx_t_1);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1845
+ * fe_span = [[e_len + 1, -1] for i in range(f_len)]
+ * ef_span = [[f_len + 1, -1] for i in range(e_len)]
* for (f, e) in alignment: # <<<<<<<<<<<<<<
* al[f].append(e)
- * al_span[f][0] = min(al_span[f][0], e)
+ * fe_span[f][0] = min(fe_span[f][0], e)
*/
if (PyList_CheckExact(__pyx_v_alignment) || PyTuple_CheckExact(__pyx_v_alignment)) {
__pyx_t_1 = __pyx_v_alignment; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_alignment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_alignment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -59602,23 +59587,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
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 = 1840; __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 = 1845; __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 = 1840; __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 = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyTuple_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 = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_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 = 1845; __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 = 1840; __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 = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_3 = __pyx_t_5(__pyx_t_1);
if (unlikely(!__pyx_t_3)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -59634,145 +59619,209 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
}
- __Pyx_INCREF(__pyx_t_6);
__Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_6);
#else
- __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1840; __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 = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#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 = 1840; __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 = 1845; __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;
- index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L9_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_6);
- index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L9_unpacking_failed;
+ index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(__pyx_t_4);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L11_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- goto __pyx_L10_unpacking_done;
- __pyx_L9_unpacking_failed:;
+ goto __pyx_L12_unpacking_done;
+ __pyx_L11_unpacking_failed:;
__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 = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_L10_unpacking_done:;
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_L12_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_f);
- __pyx_v_f = __pyx_t_6;
- __pyx_t_6 = 0;
- __Pyx_XDECREF(__pyx_v_e);
- __pyx_v_e = __pyx_t_4;
+ __pyx_v_f = __pyx_t_4;
__pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_v_e);
+ __pyx_v_e = __pyx_t_6;
+ __pyx_t_6 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1841
- * al_span = [[f_len + 1, -1] for i in range(f_len)]
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1846
+ * ef_span = [[f_len + 1, -1] for i in range(e_len)]
* for (f, e) in alignment:
* al[f].append(e) # <<<<<<<<<<<<<<
- * al_span[f][0] = min(al_span[f][0], e)
- * al_span[f][1] = max(al_span[f][1], e)
+ * fe_span[f][0] = min(fe_span[f][0], e)
+ * fe_span[f][1] = max(fe_span[f][1], e)
*/
- __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_e); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_e); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1842
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1847
* for (f, e) in alignment:
* al[f].append(e)
- * al_span[f][0] = min(al_span[f][0], e) # <<<<<<<<<<<<<<
- * al_span[f][1] = max(al_span[f][1], e)
- *
+ * fe_span[f][0] = min(fe_span[f][0], e) # <<<<<<<<<<<<<<
+ * fe_span[f][1] = max(fe_span[f][1], e)
+ * ef_span[e][0] = min(ef_span[e][0], f)
*/
__Pyx_INCREF(__pyx_v_e);
- __pyx_t_4 = __pyx_v_e;
- __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al_span, __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __pyx_v_e;
+ __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (__pyx_t_9) {
- __Pyx_INCREF(__pyx_t_4);
- __pyx_t_3 = __pyx_t_4;
- } else {
__Pyx_INCREF(__pyx_t_6);
__pyx_t_3 = __pyx_t_6;
+ } else {
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_t_3 = __pyx_t_4;
}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al_span, __pyx_v_f); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (__Pyx_SetItemInt(__pyx_t_4, 0, __pyx_t_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__Pyx_SetItemInt(__pyx_t_6, 0, __pyx_t_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1843
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1848
* al[f].append(e)
- * al_span[f][0] = min(al_span[f][0], e)
- * al_span[f][1] = max(al_span[f][1], e) # <<<<<<<<<<<<<<
- *
- * # Target side word coverage
+ * fe_span[f][0] = min(fe_span[f][0], e)
+ * fe_span[f][1] = max(fe_span[f][1], e) # <<<<<<<<<<<<<<
+ * ef_span[e][0] = min(ef_span[e][0], f)
+ * ef_span[e][1] = max(ef_span[e][1], f)
*/
__Pyx_INCREF(__pyx_v_e);
__pyx_t_3 = __pyx_v_e;
- __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al_span, __pyx_v_f); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (__pyx_t_9) {
__Pyx_INCREF(__pyx_t_3);
- __pyx_t_4 = __pyx_t_3;
+ __pyx_t_6 = __pyx_t_3;
} else {
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_t_6 = __pyx_t_4;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_6, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1849
+ * fe_span[f][0] = min(fe_span[f][0], e)
+ * fe_span[f][1] = max(fe_span[f][1], e)
+ * ef_span[e][0] = min(ef_span[e][0], f) # <<<<<<<<<<<<<<
+ * ef_span[e][1] = max(ef_span[e][1], f)
+ *
+ */
+ __Pyx_INCREF(__pyx_v_f);
+ __pyx_t_6 = __pyx_v_f;
+ __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (__pyx_t_9) {
__Pyx_INCREF(__pyx_t_6);
- __pyx_t_4 = __pyx_t_6;
+ __pyx_t_3 = __pyx_t_6;
+ } else {
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_t_3 = __pyx_t_4;
}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_e); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__Pyx_SetItemInt(__pyx_t_6, 0, __pyx_t_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1850
+ * fe_span[f][1] = max(fe_span[f][1], e)
+ * ef_span[e][0] = min(ef_span[e][0], f)
+ * ef_span[e][1] = max(ef_span[e][1], f) # <<<<<<<<<<<<<<
+ *
+ * # Target side word coverage
+ */
+ __Pyx_INCREF(__pyx_v_f);
+ __pyx_t_3 = __pyx_v_f;
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_e); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (__pyx_t_9) {
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_6 = __pyx_t_3;
+ } else {
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_t_6 = __pyx_t_4;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al_span, __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_4, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_6, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1846
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1853
*
* # Target side word coverage
* cover = [0] * e_len # <<<<<<<<<<<<<<
- *
- * # Extract all possible hierarchical phrases starting at a source index
+ * # Non-terminal coverage
+ * f_nt_cover = [0] * f_len
*/
- __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_int_0);
PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_1, __pyx_v_e_len); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_1, __pyx_v_e_len); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_temp);
__Pyx_DECREF(__pyx_t_1);
__pyx_t_1 = __pyx_temp;
@@ -59781,296 +59830,209 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
__pyx_cur_scope->__pyx_v_cover = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1850
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1855
+ * cover = [0] * e_len
+ * # Non-terminal coverage
+ * f_nt_cover = [0] * f_len # <<<<<<<<<<<<<<
+ * e_nt_cover = [0] * e_len
+ *
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_int_0);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
+ __Pyx_GIVEREF(__pyx_int_0);
+ { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_1, __pyx_cur_scope->__pyx_v_f_len); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_temp);
+ __Pyx_DECREF(__pyx_t_1);
+ __pyx_t_1 = __pyx_temp;
+ }
+ __pyx_v_f_nt_cover = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1856
+ * # Non-terminal coverage
+ * f_nt_cover = [0] * f_len
+ * e_nt_cover = [0] * e_len # <<<<<<<<<<<<<<
+ *
* # Extract all possible hierarchical phrases starting at a source index
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_int_0);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
+ __Pyx_GIVEREF(__pyx_int_0);
+ { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_1, __pyx_v_e_len); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_temp);
+ __Pyx_DECREF(__pyx_t_1);
+ __pyx_t_1 = __pyx_temp;
+ }
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ __pyx_cur_scope->__pyx_v_e_nt_cover = ((PyObject *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1861
* # f_ i and j are current, e_ i and j are previous
- * def extract(f_i, f_j, e_i, e_j, wc, links, nt, nt_open): # <<<<<<<<<<<<<<
+ * # We care _considering_ f_j, so it is not yet in counts
+ * def extract(f_i, f_j, e_i, e_j, min_bound, wc, links, nt, nt_open): # <<<<<<<<<<<<<<
* # Phrase extraction limits
- * if wc + len(nt) > self.max_length or (f_j + 1) > f_len or \
+ * if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size:
*/
- __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_12add_instance_1extract, 0, ((PyObject*)__pyx_cur_scope), __pyx_n_s___sa, ((PyObject *)__pyx_k_codeobj_135)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_12add_instance_1extract, 0, ((PyObject*)__pyx_cur_scope), __pyx_n_s___sa, ((PyObject *)__pyx_k_codeobj_135)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":1960
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1967
*
* # Try to extract phrases from every f index
- * f_i = 0 # <<<<<<<<<<<<<<
- * while f_i < f_len:
- * # Skip if phrases won't be tight on left side
- */
- __Pyx_INCREF(__pyx_int_0);
- __pyx_v_f_i = __pyx_int_0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1961
- * # Try to extract phrases from every f index
- * f_i = 0
- * while f_i < f_len: # <<<<<<<<<<<<<<
+ * for f_i from 0 <= f_i < f_len: # <<<<<<<<<<<<<<
* # Skip if phrases won't be tight on left side
* if not al[f_i]:
*/
- while (1) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_f_i, __pyx_cur_scope->__pyx_v_f_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (!__pyx_t_9) break;
+ __pyx_t_10 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_f_len); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ for (__pyx_v_f_i = 0; __pyx_v_f_i < __pyx_t_10; __pyx_v_f_i++) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1963
- * while f_i < f_len:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1969
+ * for f_i from 0 <= f_i < f_len:
* # Skip if phrases won't be tight on left side
* if not al[f_i]: # <<<<<<<<<<<<<<
- * f_i += 1
* continue
+ * extract(f_i, f_i, f_len + 1, -1, f_i, 0, [], [], False)
*/
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_10 = (!__pyx_t_9);
- if (__pyx_t_10) {
+ __pyx_t_11 = (!__pyx_t_9);
+ if (__pyx_t_11) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1964
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1970
* # Skip if phrases won't be tight on left side
* if not al[f_i]:
- * f_i += 1 # <<<<<<<<<<<<<<
- * continue
- * extract(f_i, f_i, f_len + 1, -1, 1, [], [], False)
- */
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_f_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_v_f_i);
- __pyx_v_f_i = __pyx_t_1;
- __pyx_t_1 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1965
- * if not al[f_i]:
- * f_i += 1
* continue # <<<<<<<<<<<<<<
- * extract(f_i, f_i, f_len + 1, -1, 1, [], [], False)
- * f_i += 1
+ * extract(f_i, f_i, f_len + 1, -1, f_i, 0, [], [], False)
+ *
*/
- goto __pyx_L11_continue;
- goto __pyx_L13;
+ goto __pyx_L13_continue;
+ goto __pyx_L15;
}
- __pyx_L13:;
+ __pyx_L15:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1966
- * f_i += 1
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1971
+ * if not al[f_i]:
* continue
- * extract(f_i, f_i, f_len + 1, -1, 1, [], [], False) # <<<<<<<<<<<<<<
- * f_i += 1
+ * extract(f_i, f_i, f_len + 1, -1, f_i, 0, [], [], False) # <<<<<<<<<<<<<<
*
+ * # Update phrase counts
*/
- __pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1966; __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 = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = PyTuple_New(8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Add(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_INCREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_f_i);
- __Pyx_GIVEREF(__pyx_v_f_i);
- __Pyx_INCREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_f_i);
- __Pyx_GIVEREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_1);
+ __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __pyx_t_14 = PyTuple_New(9); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
__Pyx_INCREF(__pyx_int_neg_1);
- PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_int_neg_1);
+ PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_int_neg_1);
__Pyx_GIVEREF(__pyx_int_neg_1);
- __Pyx_INCREF(__pyx_int_1);
- PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_int_1);
- __Pyx_GIVEREF(__pyx_int_1);
- PyTuple_SET_ITEM(__pyx_t_7, 5, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- PyTuple_SET_ITEM(__pyx_t_7, 6, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
- PyTuple_SET_ITEM(__pyx_t_7, 7, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_int_0);
+ __Pyx_GIVEREF(__pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_14, 6, ((PyObject *)__pyx_t_7));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
+ PyTuple_SET_ITEM(__pyx_t_14, 7, ((PyObject *)__pyx_t_12));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
+ PyTuple_SET_ITEM(__pyx_t_14, 8, __pyx_t_13);
+ __Pyx_GIVEREF(__pyx_t_13);
__pyx_t_1 = 0;
- __pyx_t_4 = 0;
- __pyx_t_3 = 0;
- __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1967
- * continue
- * extract(f_i, f_i, f_len + 1, -1, 1, [], [], False)
- * f_i += 1 # <<<<<<<<<<<<<<
- *
- * for rule in sorted(rules):
- */
- __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_f_i, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_v_f_i);
- __pyx_v_f_i = __pyx_t_6;
__pyx_t_6 = 0;
- __pyx_L11_continue:;
+ __pyx_t_3 = 0;
+ __pyx_t_4 = 0;
+ __pyx_t_7 = 0;
+ __pyx_t_12 = 0;
+ __pyx_t_13 = 0;
+ __pyx_t_13 = PyObject_Call(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __pyx_L13_continue:;
}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1969
- * f_i += 1
- *
- * for rule in sorted(rules): # <<<<<<<<<<<<<<
- * logger.info(self.fmt_rule(*rule))
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1974
*
+ * # Update phrase counts
+ * for rule in rules: # <<<<<<<<<<<<<<
+ * (f_ph, e_ph, al) = rule[:3]
+ * self.phrases_f[f_ph] += 1
*/
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rules);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_rules);
- __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_rules);
- __pyx_t_7 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
- __pyx_t_6 = __pyx_t_7; __Pyx_INCREF(__pyx_t_6); __pyx_t_2 = 0;
+ if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_rules) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_rules)) {
+ __pyx_t_13 = __pyx_cur_scope->__pyx_v_rules; __Pyx_INCREF(__pyx_t_13); __pyx_t_2 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_5 = Py_TYPE(__pyx_t_6)->tp_iternext;
+ __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_rules); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext;
}
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_6)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_6)) break;
+ if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_13)) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_13)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_14); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_6)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
+ } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_13)) {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_13)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_14); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_7 = __pyx_t_5(__pyx_t_6);
- if (unlikely(!__pyx_t_7)) {
+ __pyx_t_14 = __pyx_t_5(__pyx_t_13);
+ if (unlikely(!__pyx_t_14)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_14);
}
__Pyx_XDECREF(__pyx_v_rule);
- __pyx_v_rule = __pyx_t_7;
- __pyx_t_7 = 0;
+ __pyx_v_rule = __pyx_t_14;
+ __pyx_t_14 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1970
- *
- * for rule in sorted(rules):
- * logger.info(self.fmt_rule(*rule)) # <<<<<<<<<<<<<<
- *
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1975
* # Update phrase counts
+ * for rule in rules:
+ * (f_ph, e_ph, al) = rule[:3] # <<<<<<<<<<<<<<
+ * self.phrases_f[f_ph] += 1
+ * self.phrases_e[e_ph] += 1
*/
- __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__fmt_rule); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_4 = PySequence_Tuple(__pyx_v_rule); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- }
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1973
- *
- * # Update phrase counts
- * f_set = set() # <<<<<<<<<<<<<<
- * e_set = set()
- * for (f_ph, e_ph, al) in rules:
- */
- __pyx_t_6 = PySet_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __pyx_v_f_set = __pyx_t_6;
- __pyx_t_6 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1974
- * # Update phrase counts
- * f_set = set()
- * e_set = set() # <<<<<<<<<<<<<<
- * for (f_ph, e_ph, al) in rules:
- * f_set.add(f_ph)
- */
- __pyx_t_6 = PySet_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __pyx_v_e_set = __pyx_t_6;
- __pyx_t_6 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1975
- * f_set = set()
- * e_set = set()
- * for (f_ph, e_ph, al) in rules: # <<<<<<<<<<<<<<
- * f_set.add(f_ph)
- * e_set.add(e_ph)
- */
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_rules) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_rules)) {
- __pyx_t_6 = __pyx_cur_scope->__pyx_v_rules; __Pyx_INCREF(__pyx_t_6); __pyx_t_2 = 0;
- __pyx_t_5 = NULL;
- } else {
- __pyx_t_2 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_rules); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_5 = Py_TYPE(__pyx_t_6)->tp_iternext;
- }
- for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_6)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_6)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_6)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else {
- __pyx_t_1 = __pyx_t_5(__pyx_t_6);
- if (unlikely(!__pyx_t_1)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- break;
- }
- __Pyx_GOTREF(__pyx_t_1);
- }
- if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
- PyObject* sequence = __pyx_t_1;
+ __pyx_t_14 = __Pyx_PySequence_GetSlice(__pyx_v_rule, 0, 3); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
+ PyObject* sequence = __pyx_t_14;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -60083,231 +60045,157 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
- __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2);
+ __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
} else {
- __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
- __pyx_t_7 = PyList_GET_ITEM(sequence, 2);
+ __pyx_t_12 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 2);
}
- __Pyx_INCREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_12);
__Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_4);
#else
- __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
} else
{
Py_ssize_t index = -1;
- __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_8 = Py_TYPE(__pyx_t_11)->tp_iternext;
- index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_4)) goto __pyx_L18_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_4);
- index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_3)) goto __pyx_L18_unpacking_failed;
+ __pyx_t_3 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- index = 2; __pyx_t_7 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_7)) goto __pyx_L18_unpacking_failed;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ index = 0; __pyx_t_12 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_12)) goto __pyx_L18_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_12);
+ index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_7)) goto __pyx_L18_unpacking_failed;
__Pyx_GOTREF(__pyx_t_7);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ index = 2; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L18_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_4);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = NULL;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L19_unpacking_done;
__pyx_L18_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L19_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_f_ph);
- __pyx_v_f_ph = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_v_f_ph = __pyx_t_12;
+ __pyx_t_12 = 0;
__Pyx_XDECREF(__pyx_v_e_ph);
- __pyx_v_e_ph = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_v_e_ph = __pyx_t_7;
+ __pyx_t_7 = 0;
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_al);
__Pyx_DECREF(__pyx_cur_scope->__pyx_v_al);
- __Pyx_GIVEREF(__pyx_t_7);
- __pyx_cur_scope->__pyx_v_al = __pyx_t_7;
- __pyx_t_7 = 0;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_cur_scope->__pyx_v_al = __pyx_t_4;
+ __pyx_t_4 = 0;
/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1976
- * e_set = set()
- * for (f_ph, e_ph, al) in rules:
- * f_set.add(f_ph) # <<<<<<<<<<<<<<
- * e_set.add(e_ph)
+ * for rule in rules:
+ * (f_ph, e_ph, al) = rule[:3]
+ * self.phrases_f[f_ph] += 1 # <<<<<<<<<<<<<<
+ * self.phrases_e[e_ph] += 1
* self.phrases_fe[f_ph][e_ph] += 1
*/
- __pyx_t_12 = PySet_Add(__pyx_v_f_set, __pyx_v_f_ph); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->phrases_f);
+ __pyx_t_14 = __pyx_cur_scope->__pyx_v_self->phrases_f;
+ __Pyx_INCREF(__pyx_v_f_ph);
+ __pyx_t_4 = __pyx_v_f_ph;
+ __pyx_t_7 = PyObject_GetItem(__pyx_t_14, __pyx_t_4); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_12 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (PyObject_SetItem(__pyx_t_14, __pyx_t_4, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1977
- * for (f_ph, e_ph, al) in rules:
- * f_set.add(f_ph)
- * e_set.add(e_ph) # <<<<<<<<<<<<<<
+ * (f_ph, e_ph, al) = rule[:3]
+ * self.phrases_f[f_ph] += 1
+ * self.phrases_e[e_ph] += 1 # <<<<<<<<<<<<<<
* self.phrases_fe[f_ph][e_ph] += 1
* if not self.phrases_al[f_ph][e_ph]:
*/
- __pyx_t_12 = PySet_Add(__pyx_v_e_set, __pyx_v_e_ph); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->phrases_e);
+ __pyx_t_14 = __pyx_cur_scope->__pyx_v_self->phrases_e;
+ __Pyx_INCREF(__pyx_v_e_ph);
+ __pyx_t_4 = __pyx_v_e_ph;
+ __pyx_t_12 = PyObject_GetItem(__pyx_t_14, __pyx_t_4); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_12, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ if (PyObject_SetItem(__pyx_t_14, __pyx_t_4, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1978
- * f_set.add(f_ph)
- * e_set.add(e_ph)
+ * self.phrases_f[f_ph] += 1
+ * self.phrases_e[e_ph] += 1
* self.phrases_fe[f_ph][e_ph] += 1 # <<<<<<<<<<<<<<
* if not self.phrases_al[f_ph][e_ph]:
* self.phrases_al[f_ph][e_ph] = al
*/
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->phrases_fe, __pyx_v_f_ph); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_14 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->phrases_fe, __pyx_v_f_ph); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
__Pyx_INCREF(__pyx_v_e_ph);
- __pyx_t_7 = __pyx_v_e_ph;
- __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_t_7); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __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 = 1978; __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_t_1, __pyx_t_7, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __pyx_v_e_ph;
+ __pyx_t_7 = PyObject_GetItem(__pyx_t_14, __pyx_t_4); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_12 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetItem(__pyx_t_14, __pyx_t_4, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1979
- * e_set.add(e_ph)
+ * self.phrases_e[e_ph] += 1
* self.phrases_fe[f_ph][e_ph] += 1
* if not self.phrases_al[f_ph][e_ph]: # <<<<<<<<<<<<<<
* self.phrases_al[f_ph][e_ph] = al
- * for f_ph in f_set:
+ *
*/
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->phrases_al, __pyx_v_f_ph); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_7 = PyObject_GetItem(__pyx_t_1, __pyx_v_e_ph); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_9 = (!__pyx_t_10);
+ __pyx_t_14 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->phrases_al, __pyx_v_f_ph); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_4 = PyObject_GetItem(__pyx_t_14, __pyx_v_e_ph); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_9 = (!__pyx_t_11);
if (__pyx_t_9) {
/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1980
* self.phrases_fe[f_ph][e_ph] += 1
* if not self.phrases_al[f_ph][e_ph]:
* self.phrases_al[f_ph][e_ph] = al # <<<<<<<<<<<<<<
- * for f_ph in f_set:
- * self.phrases_f[f_ph] += 1
+ *
+ * # Update Bilexical counts
*/
- __pyx_t_7 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->phrases_al, __pyx_v_f_ph); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- if (PyObject_SetItem(__pyx_t_7, __pyx_v_e_ph, __pyx_cur_scope->__pyx_v_al) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->phrases_al, __pyx_v_f_ph); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (PyObject_SetItem(__pyx_t_4, __pyx_v_e_ph, __pyx_cur_scope->__pyx_v_al) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L20;
}
__pyx_L20:;
}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1981
- * if not self.phrases_al[f_ph][e_ph]:
- * self.phrases_al[f_ph][e_ph] = al
- * for f_ph in f_set: # <<<<<<<<<<<<<<
- * self.phrases_f[f_ph] += 1
- * for e_ph in e_set:
- */
- __pyx_t_6 = PyObject_GetIter(((PyObject *)__pyx_v_f_set)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_5 = Py_TYPE(__pyx_t_6)->tp_iternext;
- for (;;) {
- {
- __pyx_t_7 = __pyx_t_5(__pyx_t_6);
- if (unlikely(!__pyx_t_7)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- break;
- }
- __Pyx_GOTREF(__pyx_t_7);
- }
- __Pyx_XDECREF(__pyx_v_f_ph);
- __pyx_v_f_ph = __pyx_t_7;
- __pyx_t_7 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1982
- * self.phrases_al[f_ph][e_ph] = al
- * for f_ph in f_set:
- * self.phrases_f[f_ph] += 1 # <<<<<<<<<<<<<<
- * for e_ph in e_set:
- * self.phrases_e[e_ph] += 1
- */
- __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->phrases_f);
- __pyx_t_7 = __pyx_cur_scope->__pyx_v_self->phrases_f;
- __Pyx_INCREF(__pyx_v_f_ph);
- __pyx_t_1 = __pyx_v_f_ph;
- __pyx_t_4 = PyObject_GetItem(__pyx_t_7, __pyx_t_1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (PyObject_SetItem(__pyx_t_7, __pyx_t_1, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1982; __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- }
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1983
- * for f_ph in f_set:
- * self.phrases_f[f_ph] += 1
- * for e_ph in e_set: # <<<<<<<<<<<<<<
- * self.phrases_e[e_ph] += 1
- *
- */
- __pyx_t_6 = PyObject_GetIter(((PyObject *)__pyx_v_e_set)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_5 = Py_TYPE(__pyx_t_6)->tp_iternext;
- for (;;) {
- {
- __pyx_t_7 = __pyx_t_5(__pyx_t_6);
- if (unlikely(!__pyx_t_7)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- break;
- }
- __Pyx_GOTREF(__pyx_t_7);
- }
- __Pyx_XDECREF(__pyx_v_e_ph);
- __pyx_v_e_ph = __pyx_t_7;
- __pyx_t_7 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1984
- * self.phrases_f[f_ph] += 1
- * for e_ph in e_set:
- * self.phrases_e[e_ph] += 1 # <<<<<<<<<<<<<<
- *
- * # Update Bilexical counts
- */
- __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->phrases_e);
- __pyx_t_7 = __pyx_cur_scope->__pyx_v_self->phrases_e;
- __Pyx_INCREF(__pyx_v_e_ph);
- __pyx_t_1 = __pyx_v_e_ph;
- __pyx_t_3 = PyObject_GetItem(__pyx_t_7, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __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 = 1984; __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_t_7, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __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;
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- }
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1987
*
* # Update Bilexical counts
* for e_w in e_words: # <<<<<<<<<<<<<<
@@ -60315,44 +60203,44 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
* for f_w in f_words:
*/
if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_e_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_e_words)) {
- __pyx_t_6 = __pyx_cur_scope->__pyx_v_e_words; __Pyx_INCREF(__pyx_t_6); __pyx_t_2 = 0;
+ __pyx_t_13 = __pyx_cur_scope->__pyx_v_e_words; __Pyx_INCREF(__pyx_t_13); __pyx_t_2 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_e_words); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_5 = Py_TYPE(__pyx_t_6)->tp_iternext;
+ __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_e_words); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext;
}
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_6)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_6)) break;
+ if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_13)) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_13)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_6)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
+ } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_13)) {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_13)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_7 = __pyx_t_5(__pyx_t_6);
- if (unlikely(!__pyx_t_7)) {
+ __pyx_t_4 = __pyx_t_5(__pyx_t_13);
+ if (unlikely(!__pyx_t_4)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_4);
}
__Pyx_XDECREF(__pyx_v_e_w);
- __pyx_v_e_w = __pyx_t_7;
- __pyx_t_7 = 0;
+ __pyx_v_e_w = __pyx_t_4;
+ __pyx_t_4 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1988
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1984
* # Update Bilexical counts
* for e_w in e_words:
* self.bilex_e[e_w] += 1 # <<<<<<<<<<<<<<
@@ -60360,22 +60248,22 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
* self.bilex_f[f_w] += 1
*/
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->bilex_e);
- __pyx_t_7 = __pyx_cur_scope->__pyx_v_self->bilex_e;
+ __pyx_t_4 = __pyx_cur_scope->__pyx_v_self->bilex_e;
__Pyx_INCREF(__pyx_v_e_w);
- __pyx_t_1 = __pyx_v_e_w;
- __pyx_t_4 = PyObject_GetItem(__pyx_t_7, __pyx_t_1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (PyObject_SetItem(__pyx_t_7, __pyx_t_1, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __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_14 = __pyx_v_e_w;
+ __pyx_t_12 = PyObject_GetItem(__pyx_t_4, __pyx_t_14); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_12, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ if (PyObject_SetItem(__pyx_t_4, __pyx_t_14, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1989
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1985
* for e_w in e_words:
* self.bilex_e[e_w] += 1
* for f_w in f_words: # <<<<<<<<<<<<<<
@@ -60383,44 +60271,44 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
* for e_w in e_words:
*/
if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_f_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_f_words)) {
- __pyx_t_6 = __pyx_cur_scope->__pyx_v_f_words; __Pyx_INCREF(__pyx_t_6); __pyx_t_2 = 0;
+ __pyx_t_13 = __pyx_cur_scope->__pyx_v_f_words; __Pyx_INCREF(__pyx_t_13); __pyx_t_2 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_f_words); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_5 = Py_TYPE(__pyx_t_6)->tp_iternext;
+ __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_f_words); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext;
}
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_6)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_6)) break;
+ if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_13)) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_13)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_6)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
+ } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_13)) {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_13)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_7 = __pyx_t_5(__pyx_t_6);
- if (unlikely(!__pyx_t_7)) {
+ __pyx_t_4 = __pyx_t_5(__pyx_t_13);
+ if (unlikely(!__pyx_t_4)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_4);
}
__Pyx_XDECREF(__pyx_v_f_w);
- __pyx_v_f_w = __pyx_t_7;
- __pyx_t_7 = 0;
+ __pyx_v_f_w = __pyx_t_4;
+ __pyx_t_4 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1990
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1986
* self.bilex_e[e_w] += 1
* for f_w in f_words:
* self.bilex_f[f_w] += 1 # <<<<<<<<<<<<<<
@@ -60428,20 +60316,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
* self.bilex_fe[f_w][e_w] += 1
*/
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->bilex_f);
- __pyx_t_7 = __pyx_cur_scope->__pyx_v_self->bilex_f;
+ __pyx_t_4 = __pyx_cur_scope->__pyx_v_self->bilex_f;
__Pyx_INCREF(__pyx_v_f_w);
- __pyx_t_1 = __pyx_v_f_w;
- __pyx_t_3 = PyObject_GetItem(__pyx_t_7, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __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 = 1990; __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_t_7, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __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;
+ __pyx_t_14 = __pyx_v_f_w;
+ __pyx_t_7 = PyObject_GetItem(__pyx_t_4, __pyx_t_14); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_12 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (PyObject_SetItem(__pyx_t_4, __pyx_t_14, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1991
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1987
* for f_w in f_words:
* self.bilex_f[f_w] += 1
* for e_w in e_words: # <<<<<<<<<<<<<<
@@ -60449,67 +60337,67 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
*
*/
if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_e_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_e_words)) {
- __pyx_t_7 = __pyx_cur_scope->__pyx_v_e_words; __Pyx_INCREF(__pyx_t_7); __pyx_t_13 = 0;
- __pyx_t_14 = NULL;
+ __pyx_t_4 = __pyx_cur_scope->__pyx_v_e_words; __Pyx_INCREF(__pyx_t_4); __pyx_t_15 = 0;
+ __pyx_t_16 = NULL;
} else {
- __pyx_t_13 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_e_words); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_14 = Py_TYPE(__pyx_t_7)->tp_iternext;
+ __pyx_t_15 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_e_words); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_16 = Py_TYPE(__pyx_t_4)->tp_iternext;
}
for (;;) {
- if (!__pyx_t_14 && PyList_CheckExact(__pyx_t_7)) {
- if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_7)) break;
+ if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_4)) {
+ if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_15); __Pyx_INCREF(__pyx_t_14); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_7, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = PySequence_ITEM(__pyx_t_4, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- } else if (!__pyx_t_14 && PyTuple_CheckExact(__pyx_t_7)) {
- if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
+ } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_4)) {
+ if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_15); __Pyx_INCREF(__pyx_t_14); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_7, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = PySequence_ITEM(__pyx_t_4, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_1 = __pyx_t_14(__pyx_t_7);
- if (unlikely(!__pyx_t_1)) {
+ __pyx_t_14 = __pyx_t_16(__pyx_t_4);
+ if (unlikely(!__pyx_t_14)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_14);
}
__Pyx_XDECREF(__pyx_v_e_w);
- __pyx_v_e_w = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_v_e_w = __pyx_t_14;
+ __pyx_t_14 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1992
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1988
* self.bilex_f[f_w] += 1
* for e_w in e_words:
* self.bilex_fe[f_w][e_w] += 1 # <<<<<<<<<<<<<<
*
*
*/
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->bilex_fe, __pyx_v_f_w); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_14 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->bilex_fe, __pyx_v_f_w); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
__Pyx_INCREF(__pyx_v_e_w);
- __pyx_t_4 = __pyx_v_e_w;
- __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_t_4); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = __pyx_v_e_w;
+ __pyx_t_7 = PyObject_GetItem(__pyx_t_14, __pyx_t_12); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (PyObject_SetItem(__pyx_t_14, __pyx_t_12, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyObject_SetItem(__pyx_t_1, __pyx_t_4, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
}
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
@@ -60519,17 +60407,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
- __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_12);
+ __Pyx_XDECREF(__pyx_t_13);
+ __Pyx_XDECREF(__pyx_t_14);
__Pyx_AddTraceback("_sa.HieroCachingRuleFactory.add_instance", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_e_len);
__Pyx_XDECREF(__pyx_v_f);
__Pyx_XDECREF(__pyx_v_e);
- __Pyx_XDECREF(__pyx_v_f_i);
+ __Pyx_XDECREF(__pyx_v_f_nt_cover);
__Pyx_XDECREF(__pyx_v_rule);
- __Pyx_XDECREF(__pyx_v_f_set);
- __Pyx_XDECREF(__pyx_v_e_set);
__Pyx_XDECREF(__pyx_v_f_ph);
__Pyx_XDECREF(__pyx_v_e_ph);
__Pyx_XDECREF(__pyx_v_e_w);
@@ -60542,8 +60430,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _
}
/* Python wrapper */
-static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rules(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rules(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_f_i = 0;
PyObject *__pyx_v_e_i = 0;
PyObject *__pyx_v_f_span = 0;
@@ -60552,7 +60440,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rules(PyObject *
PyObject *__pyx_v_al = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("form_rules (wrapper)", 0);
+ __Pyx_RefNannySetupContext("form_rule (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f_i,&__pyx_n_s__e_i,&__pyx_n_s__f_span,&__pyx_n_s__e_span,&__pyx_n_s__nt,&__pyx_n_s__al,0};
PyObject* values[6] = {0,0,0,0,0,0};
@@ -60577,31 +60465,31 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rules(PyObject *
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e_i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("form_rules", 1, 6, 6, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __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_rules", 1, 6, 6, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __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_rules", 1, 6, 6, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __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_rules", 1, 6, 6, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __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_rules", 1, 6, 6, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __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_rules") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __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 = 1992; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
goto __pyx_L5_argtuple_error;
@@ -60622,21 +60510,21 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rules(PyObject *
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("form_rules", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __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 = 1992; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
- __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rules", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f_i, __pyx_v_e_i, __pyx_v_f_span, __pyx_v_e_span, __pyx_v_nt, __pyx_v_al);
+ __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f_i, __pyx_v_e_i, __pyx_v_f_span, __pyx_v_e_span, __pyx_v_nt, __pyx_v_al);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
-static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_10form_rules_lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_10form_rules_lambda7 = {__Pyx_NAMESTR("lambda7"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_10form_rules_lambda7, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_10form_rules_lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7 = {__Pyx_NAMESTR("lambda7"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_x = 0;
PyObject *__pyx_v_y = 0;
PyObject *__pyx_r = 0;
@@ -60662,11 +60550,11 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_10form_rules_lambda7(Py
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("lambda7", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lambda7", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda7") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda7") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
@@ -60679,9 +60567,9 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_10form_rules_lambda7(Py
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("lambda7", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lambda7", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
- __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rules.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rule.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
@@ -60690,12 +60578,12 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_10form_rules_lambda7(Py
return __pyx_r;
}
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2002
- * rules = []
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1995
*
+ * # 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
*/
static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
@@ -60709,11 +60597,11 @@ static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lambda7", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __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); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __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 = 2002; __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 = 1995; __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);
@@ -60721,7 +60609,7 @@ static PyObject *__pyx_lambda_funcdef_lambda7(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 = 2002; __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 = 1995; __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;
@@ -60734,7 +60622,7 @@ static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rules.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rule.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -60742,16 +60630,331 @@ static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self
return __pyx_r;
}
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1996
+/* Python wrapper */
+static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8 = {__Pyx_NAMESTR("lambda8"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_x = 0;
+ PyObject *__pyx_v_y = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("lambda8 (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0};
+ PyObject* values[2] = {0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ 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 = 2019; __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 = 2019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ }
+ __pyx_v_x = values[0];
+ __pyx_v_y = values[1];
+ }
+ 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 = 2019; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rule.lambda8", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_lambda_funcdef_lambda8(__pyx_self, __pyx_v_x, __pyx_v_y);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2019
+ * # 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)
+ */
+
+static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("lambda8", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __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); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __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 = 2019; __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);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
+ __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 = 2019; __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;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rule.lambda8", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_9form_rule_4generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2053
+ * 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)
+ *
+ */
+
+static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(PyObject *__pyx_self) {
+ struct __pyx_obj_3_sa___pyx_scope_struct_22_genexpr *__pyx_cur_scope;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("genexpr", 0);
+ __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_22_genexpr *)__pyx_ptype_3_sa___pyx_scope_struct_22_genexpr->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_22_genexpr, __pyx_empty_tuple, NULL);
+ if (unlikely(!__pyx_cur_scope)) {
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ }
+ __Pyx_GOTREF(__pyx_cur_scope);
+ __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule *) __pyx_self;
+ __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_3_sa_23HieroCachingRuleFactory_9form_rule_4generator14, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_cur_scope);
+ __Pyx_RefNannyFinishContext();
+ return (PyObject *) gen;
+ }
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rule.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_9form_rule_4generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+{
+ struct __pyx_obj_3_sa___pyx_scope_struct_22_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_22_genexpr *)__pyx_generator->closure);
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ Py_ssize_t __pyx_t_2;
+ PyObject *(*__pyx_t_3)(PyObject *);
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *(*__pyx_t_8)(PyObject *);
+ int __pyx_t_9;
+ int __pyx_t_10;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("None", 0);
+ switch (__pyx_generator->resume_label) {
+ case 0: goto __pyx_L3_first_run;
+ case 1: goto __pyx_L8_resume_from_yield;
+ default: /* CPython raises the right error here */
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ }
+ __pyx_L3_first_run:;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __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 = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_links) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_links)) {
+ __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_links; __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_links); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ }
+ for (;;) {
+ 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 = 2053; __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 = 2053; __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 = 2053; __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 = 2053; __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 = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_4);
+ }
+ if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
+ PyObject* sequence = __pyx_t_4;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ #if CYTHON_COMPILING_IN_CPYTHON
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
+ } else {
+ __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
+ }
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ #else
+ __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else
+ {
+ Py_ssize_t index = -1;
+ __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
+ index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_5);
+ index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = NULL;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L7_unpacking_done;
+ __pyx_L6_unpacking_failed:;
+ __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 = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_L7_unpacking_done:;
+ }
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
+ __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_i);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_cur_scope->__pyx_v_i = __pyx_t_5;
+ __pyx_t_5 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_j);
+ __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_j);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_cur_scope->__pyx_v_j = __pyx_t_6;
+ __pyx_t_6 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyInt_FromLong(((struct __pyx_vtabstruct_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_9, __pyx_t_10)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ /* return from generator, yielding value */
+ __pyx_generator->resume_label = 1;
+ return __pyx_r;
+ __pyx_L8_resume_from_yield:;
+ __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_cur_scope->__pyx_t_0 = 0;
+ __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 = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ PyErr_SetNone(PyExc_StopIteration);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+}
+
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1992
*
* # Create a rule from source, target, non-terminals, and alignments
- * def form_rules(self, f_i, e_i, f_span, e_span, nt, al): # <<<<<<<<<<<<<<
+ * def form_rule(self, f_i, e_i, f_span, e_span, nt, al): # <<<<<<<<<<<<<<
*
- * # This could be more efficient but is unlikely to be the bottleneck
+ * # Substitute in non-terminals
*/
-static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_i, PyObject *__pyx_v_e_i, PyObject *__pyx_v_f_span, PyObject *__pyx_v_e_span, PyObject *__pyx_v_nt, PyObject *__pyx_v_al) {
- PyObject *__pyx_v_rules = NULL;
+static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_i, PyObject *__pyx_v_e_i, PyObject *__pyx_v_f_span, PyObject *__pyx_v_e_span, PyObject *__pyx_v_nt, PyObject *__pyx_v_al) {
+ struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule *__pyx_cur_scope;
PyObject *__pyx_v_nt_inv = NULL;
PyObject *__pyx_v_f_sym = NULL;
PyObject *__pyx_v_off = NULL;
@@ -60759,14 +60962,16 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
PyObject *__pyx_v_nt_len = NULL;
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_e_sym = NULL;
- PyObject *__pyx_v_links = NULL;
+ PyObject *__pyx_v_links_inv = NULL;
PyObject *__pyx_v_links_len = NULL;
PyObject *__pyx_v_nt_i = NULL;
- PyObject *__pyx_v_last_index = NULL;
- PyObject *__pyx_v_f_len = NULL;
- PyObject *__pyx_v_e_len = NULL;
- PyObject *__pyx_v_link = NULL;
+ PyObject *__pyx_v_lex_f_i = NULL;
+ PyObject *__pyx_v_lex_f_j = NULL;
+ struct __pyx_obj_3_sa_Phrase *__pyx_v_f = NULL;
+ struct __pyx_obj_3_sa_Phrase *__pyx_v_e = NULL;
+ PyObject *__pyx_v_a = NULL;
PyObject *__pyx_v_sub = NULL;
+ PyObject *__pyx_v_link = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -60783,73 +60988,67 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
PyObject *__pyx_t_12 = NULL;
int __pyx_t_13;
int __pyx_t_14;
- long __pyx_t_15;
- long __pyx_t_16;
- int __pyx_t_17;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("form_rules", 0);
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2000
- * # This could be more efficient but is unlikely to be the bottleneck
- *
- * rules = [] # <<<<<<<<<<<<<<
- *
- * nt_inv = sorted(nt, cmp=lambda x, y: cmp(x[3], y[3]))
- */
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_v_rules = __pyx_t_1;
- __pyx_t_1 = 0;
+ __Pyx_RefNannySetupContext("form_rule", 0);
+ __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule *)__pyx_ptype_3_sa___pyx_scope_struct_21_form_rule->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_21_form_rule, __pyx_empty_tuple, NULL);
+ if (unlikely(!__pyx_cur_scope)) {
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ }
+ __Pyx_GOTREF(__pyx_cur_scope);
+ __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
+ __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
+ __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2002
- * rules = []
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1995
*
+ * # 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 = 2002; __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 = 1995; __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 = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_10form_rules_lambda7, 0, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7, 0, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __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 = 2002; __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 = 1995; __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 = 2002; __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 = 1995; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":2004
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1996
+ * # 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_PySequence_GetSlice(__pyx_v_f_span, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_v_f_span, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __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 = 2004; __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 = 1996; __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 = 2004; __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 = 1996; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":2005
- *
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1997
+ * 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:
@@ -60858,7 +61057,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__Pyx_INCREF(__pyx_v_f_i);
__pyx_v_off = __pyx_v_f_i;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2006
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1998
* f_sym = list(f_span[:])
* off = f_i
* for next_nt in nt: # <<<<<<<<<<<<<<
@@ -60869,7 +61068,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__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 = 2006; __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 = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
@@ -60877,23 +61076,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
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 = 2006; __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 = 1998; __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 = 2006; __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 = 1998; __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 = 2006; __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 = 1998; __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 = 2006; __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 = 1998; __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 = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -60903,29 +61102,29 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__pyx_v_next_nt = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2007
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1999
* 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); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __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); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __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 = 2007; __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 = 1999; __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 = 2007; __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 = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_v_nt_len);
__pyx_v_nt_len = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2008
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2000
* for next_nt in nt:
* nt_len = (next_nt[2] - next_nt[1]) + 1
* i = 0 # <<<<<<<<<<<<<<
@@ -60936,7 +61135,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__Pyx_XDECREF(__pyx_v_i);
__pyx_v_i = __pyx_int_0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2009
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2001
* nt_len = (next_nt[2] - next_nt[1]) + 1
* i = 0
* while i < nt_len: # <<<<<<<<<<<<<<
@@ -60944,83 +61143,83 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
* 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 = 2009; __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 = 2009; __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 = 2001; __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 = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_7) break;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2010
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2002
* 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 = PyObject_GetAttr(((PyObject *)__pyx_v_f_sym), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_f_sym), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __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); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __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 = 2010; __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 = 2002; __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 = 2010; __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 = 2002; __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 = 2010; __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 = 2002; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":2011
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2003
* 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 = 2011; __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 = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_v_i);
__pyx_v_i = __pyx_t_2;
__pyx_t_2 = 0;
}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2012
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2004
* 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); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __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 = 2012; __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 = 2004; __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 = 2012; __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 = 2004; __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); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __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 = 2012; __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 = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyInt_FromLong(__pyx_f_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 = 2004; __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 = 2012; __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 = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2013
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2005
* 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 = 2013; __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 = 2005; __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 = 2013; __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 = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_v_off);
@@ -61029,28 +61228,28 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2015
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2006
+ * 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_PySequence_GetSlice(__pyx_v_e_span, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_v_e_span, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __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 = 2015; __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 = 2006; __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 = 2015; __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 = 2006; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":2016
- *
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2007
+ * off += (nt_len - 1)
* e_sym = list(e_span[:])
* off = e_i # <<<<<<<<<<<<<<
* for next_nt in nt_inv:
@@ -61060,7 +61259,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__Pyx_DECREF(__pyx_v_off);
__pyx_v_off = __pyx_v_e_i;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2017
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2008
* e_sym = list(e_span[:])
* off = e_i
* for next_nt in nt_inv: # <<<<<<<<<<<<<<
@@ -61071,7 +61270,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__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 = 2017; __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 = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
@@ -61079,23 +61278,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
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 = 2017; __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 = 2008; __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 = 2017; __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 = 2008; __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 = 2017; __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 = 2008; __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 = 2017; __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 = 2008; __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 = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -61105,29 +61304,29 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__pyx_v_next_nt = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2018
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2009
* 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); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __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); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __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 = 2018; __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 = 2009; __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 = 2018; __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 = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_v_nt_len);
__pyx_v_nt_len = __pyx_t_6;
__pyx_t_6 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2019
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2010
* for next_nt in nt_inv:
* nt_len = (next_nt[4] - next_nt[3]) + 1
* i = 0 # <<<<<<<<<<<<<<
@@ -61138,7 +61337,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__Pyx_XDECREF(__pyx_v_i);
__pyx_v_i = __pyx_int_0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2020
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2011
* nt_len = (next_nt[4] - next_nt[3]) + 1
* i = 0
* while i < nt_len: # <<<<<<<<<<<<<<
@@ -61146,83 +61345,83 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
* 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 = 2020; __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 = 2020; __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 = 2011; __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 = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (!__pyx_t_7) break;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2021
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2012
* 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 = PyObject_GetAttr(((PyObject *)__pyx_v_e_sym), __pyx_n_s__pop); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_e_sym), __pyx_n_s__pop); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __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); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __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 = 2021; __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 = 2012; __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 = 2021; __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 = 2012; __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 = 2021; __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 = 2012; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":2022
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2013
* 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 = 2022; __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 = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_v_i);
__pyx_v_i = __pyx_t_2;
__pyx_t_2 = 0;
}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2023
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2014
* 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); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2014; __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 = 2023; __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 = 2014; __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 = 2023; __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 = 2014; __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); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2014; __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 = 2023; __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 = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromLong(__pyx_f_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 = 2014; __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 = 2023; __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 = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2024
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2015
* 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 = 2024; __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 = 2015; __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 = 2024; __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 = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_v_off);
@@ -61231,20 +61430,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2027
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2018
*
* # 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 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __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 = 2018; __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 = 2027; __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 = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
}
@@ -61252,23 +61451,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
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 = 2027; __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 = 2018; __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 = 2027; __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 = 2018; __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 = 2027; __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 = 2018; __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 = 2027; __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 = 2018; __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 = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -61281,7 +61480,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__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 = 2027; __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 = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -61289,23 +61488,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
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 = 2027; __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 = 2018; __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 = 2027; __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 = 2018; __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 = 2027; __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 = 2018; __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 = 2027; __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 = 2018; __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 = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -61314,52 +61513,81 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__Pyx_XDECREF(__pyx_v_link);
__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 = 2027; __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 = 2018; __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 = 2027; __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 = 2018; __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_PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_12))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_12))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __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;
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)__pyx_t_3));
- __pyx_v_links = __pyx_t_3;
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+ __pyx_cur_scope->__pyx_v_links = ((PyObject *)__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2028
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2019
* # Adjusting alignment links takes some doing
* links = [list(link) for sub in al for link in sub]
- * links_len = len(links) # <<<<<<<<<<<<<<
+ * links_inv = sorted(links, cmp=lambda x, y: cmp(x[1], y[1])) # <<<<<<<<<<<<<<
+ * links_len = len(links)
* nt_len = len(nt)
- * nt_i = 0
*/
- __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_links)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __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 = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_v_links_len = __pyx_t_3;
- __pyx_t_3 = 0;
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_links);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_links);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_links);
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8, 0, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __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 = 2019; __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 = 2019; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":2029
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2020
* 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)
+ * nt_i = 0
+ */
+ __pyx_t_1 = __pyx_cur_scope->__pyx_v_links;
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_t_4 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __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 = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_links_len = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2021
+ * 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 = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __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 = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_v_nt_len);
- __pyx_v_nt_len = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_v_nt_len = __pyx_t_1;
+ __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2030
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2022
* links_len = len(links)
* nt_len = len(nt)
* nt_i = 0 # <<<<<<<<<<<<<<
@@ -61369,7 +61597,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__Pyx_INCREF(__pyx_int_0);
__pyx_v_nt_i = __pyx_int_0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2031
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2023
* nt_len = len(nt)
* nt_i = 0
* off = f_i # <<<<<<<<<<<<<<
@@ -61380,7 +61608,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__Pyx_DECREF(__pyx_v_off);
__pyx_v_off = __pyx_v_f_i;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2032
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2024
* nt_i = 0
* off = f_i
* i = 0 # <<<<<<<<<<<<<<
@@ -61391,7 +61619,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__Pyx_XDECREF(__pyx_v_i);
__pyx_v_i = __pyx_int_0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2033
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2025
* off = f_i
* i = 0
* while i < links_len: # <<<<<<<<<<<<<<
@@ -61399,12 +61627,12 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
* off += (nt[nt_i][2] - nt[nt_i][1])
*/
while (1) {
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_i, __pyx_v_links_len, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __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 = 2025; __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 = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_7) break;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2034
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2026
* i = 0
* while i < links_len:
* while nt_i < nt_len and links[i][0] > nt[nt_i][1]: # <<<<<<<<<<<<<<
@@ -61412,107 +61640,107 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
* nt_i += 1
*/
while (1) {
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_nt_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __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 = 2026; __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 = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_7) {
- __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_links), __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_links, __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2026; __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); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __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 = 2026; __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 = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_14 = __pyx_t_13;
} else {
__pyx_t_14 = __pyx_t_7;
}
if (!__pyx_t_14) break;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2035
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2027
* 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_3 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __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 = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 2027; __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); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __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_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __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_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __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 = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_v_off);
__pyx_v_off = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2036
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2028
* 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 = 2036; __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 = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_v_nt_i);
__pyx_v_nt_i = __pyx_t_2;
__pyx_t_2 = 0;
}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2037
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2029
* 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_v_links), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_links, __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = 0;
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_v_off); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2037; __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); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__Pyx_SetItemInt(__pyx_t_2, __pyx_t_4, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2037; __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 = 2029; __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) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2029; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":2038
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2030
* 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 = 2038; __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 = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_v_i);
__pyx_v_i = __pyx_t_2;
__pyx_t_2 = 0;
}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2039
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2031
* links[i][0] -= off
* i += 1
* nt_i = 0 # <<<<<<<<<<<<<<
@@ -61523,7 +61751,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__Pyx_DECREF(__pyx_v_nt_i);
__pyx_v_nt_i = __pyx_int_0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2040
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2032
* i += 1
* nt_i = 0
* off = e_i # <<<<<<<<<<<<<<
@@ -61534,56 +61762,56 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
__Pyx_DECREF(__pyx_v_off);
__pyx_v_off = __pyx_v_e_i;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2041
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2033
* nt_i = 0
* off = e_i
* i = 0 # <<<<<<<<<<<<<<
* while i < links_len:
- * while nt_i < nt_len and links[i][1] > nt_inv[nt_i][3]:
+ * while nt_i < nt_len and links_inv[i][1] > nt_inv[nt_i][3]:
*/
__Pyx_INCREF(__pyx_int_0);
__Pyx_DECREF(__pyx_v_i);
__pyx_v_i = __pyx_int_0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2042
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2034
* off = e_i
* i = 0
* while i < links_len: # <<<<<<<<<<<<<<
- * while nt_i < nt_len and links[i][1] > nt_inv[nt_i][3]:
+ * 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])
*/
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 = 2042; __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 = 2042; __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 = 2034; __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 = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (!__pyx_t_14) break;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2043
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2035
* i = 0
* while i < links_len:
- * while nt_i < nt_len and links[i][1] > nt_inv[nt_i][3]: # <<<<<<<<<<<<<<
+ * 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
*/
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 = 2043; __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 = 2043; __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 = 2035; __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 = 2035; __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(((PyObject *)__pyx_v_links), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __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 = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __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 = 2043; __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 = 2035; __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); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __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_1, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_13 = __pyx_t_7;
} else {
@@ -61591,1079 +61819,289 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rules(struct __p
}
if (!__pyx_t_13) break;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2044
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2036
* while i < links_len:
- * while nt_i < nt_len and links[i][1] > nt_inv[nt_i][3]:
+ * 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[i][1] -= off
+ * 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 = 2044; __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 = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2036; __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 = 2044; __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 = 2036; __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); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2036; __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_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2044; __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 = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __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 = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_v_off);
- __pyx_v_off = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_v_off = __pyx_t_3;
+ __pyx_t_3 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2045
- * while nt_i < nt_len and links[i][1] > nt_inv[nt_i][3]:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2037
+ * 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[i][1] -= off
+ * links_inv[i][1] -= off
* i += 1
*/
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_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 = 2037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_v_nt_i);
- __pyx_v_nt_i = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_v_nt_i = __pyx_t_3;
+ __pyx_t_3 = 0;
}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2046
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2038
* off += (nt_inv[nt_i][4] - nt_inv[nt_i][3])
* nt_i += 1
- * links[i][1] -= off # <<<<<<<<<<<<<<
+ * links_inv[i][1] -= off # <<<<<<<<<<<<<<
* i += 1
*
*/
- __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_links), __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = 1;
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __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); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __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_1, __pyx_t_4, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (__Pyx_SetItemInt(__pyx_t_3, __pyx_t_4, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":2047
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2039
* nt_i += 1
- * links[i][1] -= off
+ * links_inv[i][1] -= off
* i += 1 # <<<<<<<<<<<<<<
*
- * # Rule
+ * # Find lexical span
*/
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_v_i);
- __pyx_v_i = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_v_i = __pyx_t_3;
+ __pyx_t_3 = 0;
}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2050
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2042
*
- * # Rule
- * rules.append(self.new_rule(f_sym, e_sym, links)) # <<<<<<<<<<<<<<
- * if len(f_sym) >= self.max_length or len(nt) >= self.max_nonterminals:
- * return rules
- */
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__new_rule); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_v_f_sym));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_f_sym));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_f_sym));
- __Pyx_INCREF(((PyObject *)__pyx_v_e_sym));
- PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_e_sym));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_e_sym));
- __Pyx_INCREF(((PyObject *)__pyx_v_links));
- PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_links));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_links));
- __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 = 2050; __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_t_10 = PyList_Append(__pyx_v_rules, __pyx_t_2); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2051
- * # Rule
- * rules.append(self.new_rule(f_sym, e_sym, links))
- * if len(f_sym) >= self.max_length or len(nt) >= self.max_nonterminals: # <<<<<<<<<<<<<<
- * return rules
- * last_index = nt[-1][0] if nt else 0
- */
- __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_f_sym)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_13 = (__pyx_t_4 >= __pyx_v_self->max_length);
- if (!__pyx_t_13) {
- __pyx_t_4 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_14 = (__pyx_t_4 >= __pyx_v_self->max_nonterminals);
- __pyx_t_7 = __pyx_t_14;
- } else {
- __pyx_t_7 = __pyx_t_13;
- }
- if (__pyx_t_7) {
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2052
- * rules.append(self.new_rule(f_sym, e_sym, links))
- * if len(f_sym) >= self.max_length or len(nt) >= self.max_nonterminals:
- * return rules # <<<<<<<<<<<<<<
- * last_index = nt[-1][0] if nt else 0
- * # Rule [X]
- */
- __Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(((PyObject *)__pyx_v_rules));
- __pyx_r = ((PyObject *)__pyx_v_rules);
- goto __pyx_L0;
- goto __pyx_L23;
- }
- __pyx_L23:;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2053
- * if len(f_sym) >= self.max_length or len(nt) >= self.max_nonterminals:
- * return rules
- * last_index = nt[-1][0] if nt else 0 # <<<<<<<<<<<<<<
- * # Rule [X]
- * if not nt or not sym_isvar(f_sym[-1]):
+ * # Find lexical span
+ * lex_f_i = f_i # <<<<<<<<<<<<<<
+ * lex_f_j = f_i + (len(f_span) - 1)
+ * if nt:
*/
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_7) {
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_2 = __pyx_t_1;
- __pyx_t_1 = 0;
- } else {
- __Pyx_INCREF(__pyx_int_0);
- __pyx_t_2 = __pyx_int_0;
- }
- __pyx_v_last_index = __pyx_t_2;
- __pyx_t_2 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2055
- * last_index = nt[-1][0] if nt else 0
- * # Rule [X]
- * if not nt or not sym_isvar(f_sym[-1]): # <<<<<<<<<<<<<<
- * f_sym.append(sym_setindex(self.category, last_index + 1))
- * e_sym.append(sym_setindex(self.category, last_index + 1))
- */
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_13 = (!__pyx_t_7);
- if (!__pyx_t_13) {
- __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_f_sym), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_7 = (!__pyx_f_3_sa_sym_isvar(__pyx_t_9));
- __pyx_t_14 = __pyx_t_7;
- } else {
- __pyx_t_14 = __pyx_t_13;
- }
- if (__pyx_t_14) {
+ __Pyx_INCREF(__pyx_v_f_i);
+ __pyx_v_lex_f_i = __pyx_v_f_i;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2056
- * # Rule [X]
- * if not nt or not sym_isvar(f_sym[-1]):
- * f_sym.append(sym_setindex(self.category, last_index + 1)) # <<<<<<<<<<<<<<
- * e_sym.append(sym_setindex(self.category, last_index + 1))
- * rules.append(self.new_rule(f_sym, e_sym, links))
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2043
+ * # 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_2 = PyNumber_Add(__pyx_v_last_index, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = PyList_Append(__pyx_v_f_sym, __pyx_t_2); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = PyObject_Length(__pyx_v_f_span); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __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 = 2043; __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 = 2043; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":2057
- * if not nt or not sym_isvar(f_sym[-1]):
- * f_sym.append(sym_setindex(self.category, last_index + 1))
- * e_sym.append(sym_setindex(self.category, last_index + 1)) # <<<<<<<<<<<<<<
- * rules.append(self.new_rule(f_sym, e_sym, links))
- * f_sym.pop()
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2044
+ * 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_2 = PyNumber_Add(__pyx_v_last_index, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = PyList_Append(__pyx_v_e_sym, __pyx_t_2); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_13) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2058
- * f_sym.append(sym_setindex(self.category, last_index + 1))
- * e_sym.append(sym_setindex(self.category, last_index + 1))
- * rules.append(self.new_rule(f_sym, e_sym, links)) # <<<<<<<<<<<<<<
- * f_sym.pop()
- * e_sym.pop()
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2045
+ * 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_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__new_rule); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __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_INCREF(((PyObject *)__pyx_v_e_sym));
- PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_e_sym));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_e_sym));
- __Pyx_INCREF(((PyObject *)__pyx_v_links));
- PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_links));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_links));
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __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_1)); __pyx_t_1 = 0;
- __pyx_t_10 = PyList_Append(__pyx_v_rules, __pyx_t_3); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2059
- * e_sym.append(sym_setindex(self.category, last_index + 1))
- * rules.append(self.new_rule(f_sym, e_sym, links))
- * f_sym.pop() # <<<<<<<<<<<<<<
- * e_sym.pop()
- * # [X] Rule
- */
- __pyx_t_3 = __Pyx_PyObject_Pop(((PyObject *)__pyx_v_f_sym)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2060
- * rules.append(self.new_rule(f_sym, e_sym, links))
- * f_sym.pop()
- * e_sym.pop() # <<<<<<<<<<<<<<
- * # [X] Rule
- * f_len = len(f_sym)
- */
- __pyx_t_3 = __Pyx_PyObject_Pop(((PyObject *)__pyx_v_e_sym)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- goto __pyx_L24;
- }
- __pyx_L24:;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2062
- * e_sym.pop()
- * # [X] Rule
- * f_len = len(f_sym) # <<<<<<<<<<<<<<
- * e_len = len(e_sym)
- * if not nt or not sym_isvar(f_sym[0]):
- */
- __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_f_sym)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_v_f_len = __pyx_t_3;
- __pyx_t_3 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2063
- * # [X] Rule
- * f_len = len(f_sym)
- * e_len = len(e_sym) # <<<<<<<<<<<<<<
- * if not nt or not sym_isvar(f_sym[0]):
- * for i from 0 <= i < f_len:
- */
- __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_e_sym)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); 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_v_e_len = __pyx_t_3;
- __pyx_t_3 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2064
- * f_len = len(f_sym)
- * e_len = len(e_sym)
- * if not nt or not sym_isvar(f_sym[0]): # <<<<<<<<<<<<<<
- * for i from 0 <= i < f_len:
- * if sym_isvar(f_sym[i]):
- */
- __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_13 = (!__pyx_t_14);
- if (!__pyx_t_13) {
- __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_f_sym), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_14 = (!__pyx_f_3_sa_sym_isvar(__pyx_t_9));
- __pyx_t_7 = __pyx_t_14;
- } else {
- __pyx_t_7 = __pyx_t_13;
- }
- if (__pyx_t_7) {
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2065
- * e_len = len(e_sym)
- * if not nt or not sym_isvar(f_sym[0]):
- * for i from 0 <= i < f_len: # <<<<<<<<<<<<<<
- * if sym_isvar(f_sym[i]):
- * f_sym[i] = sym_setindex(self.category, sym_getindex(f_sym[i]) + 1)
- */
- __pyx_t_15 = __Pyx_PyInt_AsLong(__pyx_v_f_len); if (unlikely((__pyx_t_15 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16++) {
- __pyx_t_3 = PyInt_FromLong(__pyx_t_16); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_v_i);
- __pyx_v_i = __pyx_t_3;
- __pyx_t_3 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2066
- * if not nt or not sym_isvar(f_sym[0]):
- * for i from 0 <= i < f_len:
- * if sym_isvar(f_sym[i]): # <<<<<<<<<<<<<<
- * f_sym[i] = sym_setindex(self.category, sym_getindex(f_sym[i]) + 1)
- * for i from 0 <= i < e_len:
- */
- __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_f_sym), __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_17 = __pyx_f_3_sa_sym_isvar(__pyx_t_9);
- if (__pyx_t_17) {
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2067
- * for i from 0 <= i < f_len:
- * if sym_isvar(f_sym[i]):
- * f_sym[i] = sym_setindex(self.category, sym_getindex(f_sym[i]) + 1) # <<<<<<<<<<<<<<
- * for i from 0 <= i < e_len:
- * if sym_isvar(e_sym[i]):
- */
- __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_f_sym), __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, (__pyx_f_3_sa_sym_getindex(__pyx_t_17) + 1))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyObject_SetItem(((PyObject *)__pyx_v_f_sym), __pyx_v_i, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- goto __pyx_L28;
- }
- __pyx_L28:;
- __pyx_t_16 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_16 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2065
- * e_len = len(e_sym)
- * if not nt or not sym_isvar(f_sym[0]):
- * for i from 0 <= i < f_len: # <<<<<<<<<<<<<<
- * if sym_isvar(f_sym[i]):
- * f_sym[i] = sym_setindex(self.category, sym_getindex(f_sym[i]) + 1)
- */
- __pyx_t_3 = PyInt_FromLong(__pyx_t_16); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_v_i);
- __pyx_v_i = __pyx_t_3;
- __pyx_t_3 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2068
- * if sym_isvar(f_sym[i]):
- * f_sym[i] = sym_setindex(self.category, sym_getindex(f_sym[i]) + 1)
- * for i from 0 <= i < e_len: # <<<<<<<<<<<<<<
- * if sym_isvar(e_sym[i]):
- * e_sym[i] = sym_setindex(self.category, sym_getindex(e_sym[i]) + 1)
- */
- __pyx_t_16 = __Pyx_PyInt_AsLong(__pyx_v_e_len); if (unlikely((__pyx_t_16 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++) {
- __pyx_t_3 = PyInt_FromLong(__pyx_t_15); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_v_i);
- __pyx_v_i = __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 = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_13) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2069
- * f_sym[i] = sym_setindex(self.category, sym_getindex(f_sym[i]) + 1)
- * for i from 0 <= i < e_len:
- * if sym_isvar(e_sym[i]): # <<<<<<<<<<<<<<
- * e_sym[i] = sym_setindex(self.category, sym_getindex(e_sym[i]) + 1)
- * for link in links:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2046
+ * 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_3 = PyObject_GetItem(((PyObject *)__pyx_v_e_sym), __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __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); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_9 = __pyx_f_3_sa_sym_isvar(__pyx_t_17);
- if (__pyx_t_9) {
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2070
- * for i from 0 <= i < e_len:
- * if sym_isvar(e_sym[i]):
- * e_sym[i] = sym_setindex(self.category, sym_getindex(e_sym[i]) + 1) # <<<<<<<<<<<<<<
- * for link in links:
- * link[0] += 1
- */
- __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_e_sym), __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, (__pyx_f_3_sa_sym_getindex(__pyx_t_9) + 1))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyObject_SetItem(((PyObject *)__pyx_v_e_sym), __pyx_v_i, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- goto __pyx_L31;
- }
- __pyx_L31:;
- __pyx_t_15 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_15 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2068
- * if sym_isvar(f_sym[i]):
- * f_sym[i] = sym_setindex(self.category, sym_getindex(f_sym[i]) + 1)
- * for i from 0 <= i < e_len: # <<<<<<<<<<<<<<
- * if sym_isvar(e_sym[i]):
- * e_sym[i] = sym_setindex(self.category, sym_getindex(e_sym[i]) + 1)
- */
- __pyx_t_3 = PyInt_FromLong(__pyx_t_15); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_v_i);
- __pyx_v_i = __pyx_t_3;
- __pyx_t_3 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2071
- * if sym_isvar(e_sym[i]):
- * e_sym[i] = sym_setindex(self.category, sym_getindex(e_sym[i]) + 1)
- * for link in links: # <<<<<<<<<<<<<<
- * link[0] += 1
- * link[1] += 1
- */
- __pyx_t_3 = ((PyObject *)__pyx_v_links); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
- for (;;) {
- if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- __Pyx_XDECREF(__pyx_v_link);
- __pyx_v_link = __pyx_t_1;
- __pyx_t_1 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2072
- * e_sym[i] = sym_setindex(self.category, sym_getindex(e_sym[i]) + 1)
- * for link in links:
- * link[0] += 1 # <<<<<<<<<<<<<<
- * link[1] += 1
- * f_sym.insert(0, sym_setindex(self.category, 1))
- */
- __pyx_t_8 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_link, __pyx_t_8, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__Pyx_SetItemInt(__pyx_v_link, __pyx_t_8, __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __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 = 2046; __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;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2073
- * for link in links:
- * link[0] += 1
- * link[1] += 1 # <<<<<<<<<<<<<<
- * f_sym.insert(0, sym_setindex(self.category, 1))
- * e_sym.insert(0, sym_setindex(self.category, 1))
- */
- __pyx_t_8 = 1;
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_link, __pyx_t_8, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __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 = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 2046; __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_v_link, __pyx_t_8, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_v_lex_f_i);
+ __pyx_v_lex_f_i = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L24;
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2074
- * link[0] += 1
- * link[1] += 1
- * f_sym.insert(0, sym_setindex(self.category, 1)) # <<<<<<<<<<<<<<
- * e_sym.insert(0, sym_setindex(self.category, 1))
- * rules.append(self.new_rule(f_sym, e_sym, links))
- */
- __pyx_t_3 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, 1)); 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_10 = PyList_Insert(__pyx_v_f_sym, 0, __pyx_t_3); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2075
- * link[1] += 1
- * f_sym.insert(0, sym_setindex(self.category, 1))
- * e_sym.insert(0, sym_setindex(self.category, 1)) # <<<<<<<<<<<<<<
- * rules.append(self.new_rule(f_sym, e_sym, links))
- * if len(f_sym) >= self.max_length or len(nt) + 1 >= self.max_nonterminals:
- */
- __pyx_t_3 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_10 = PyList_Insert(__pyx_v_e_sym, 0, __pyx_t_3); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2076
- * f_sym.insert(0, sym_setindex(self.category, 1))
- * e_sym.insert(0, sym_setindex(self.category, 1))
- * rules.append(self.new_rule(f_sym, e_sym, links)) # <<<<<<<<<<<<<<
- * if len(f_sym) >= self.max_length or len(nt) + 1 >= self.max_nonterminals:
- * return rules
- */
- __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__new_rule); 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_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __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_INCREF(((PyObject *)__pyx_v_e_sym));
- PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_e_sym));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_e_sym));
- __Pyx_INCREF(((PyObject *)__pyx_v_links));
- PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_links));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_links));
- __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_t_10 = PyList_Append(__pyx_v_rules, __pyx_t_2); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- goto __pyx_L25;
- }
- __pyx_L25:;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2077
- * e_sym.insert(0, sym_setindex(self.category, 1))
- * rules.append(self.new_rule(f_sym, e_sym, links))
- * if len(f_sym) >= self.max_length or len(nt) + 1 >= self.max_nonterminals: # <<<<<<<<<<<<<<
- * return rules
- * # [X] Rule [X]
- */
- __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_f_sym)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_7 = (__pyx_t_4 >= __pyx_v_self->max_length);
- if (!__pyx_t_7) {
- __pyx_t_4 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_13 = ((__pyx_t_4 + 1) >= __pyx_v_self->max_nonterminals);
- __pyx_t_14 = __pyx_t_13;
- } else {
- __pyx_t_14 = __pyx_t_7;
- }
- if (__pyx_t_14) {
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2078
- * rules.append(self.new_rule(f_sym, e_sym, links))
- * if len(f_sym) >= self.max_length or len(nt) + 1 >= self.max_nonterminals:
- * return rules # <<<<<<<<<<<<<<
- * # [X] Rule [X]
- * if not nt or not sym_isvar(f_sym[-1]):
- */
- __Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(((PyObject *)__pyx_v_rules));
- __pyx_r = ((PyObject *)__pyx_v_rules);
- goto __pyx_L0;
- goto __pyx_L34;
- }
- __pyx_L34:;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2080
- * return rules
- * # [X] Rule [X]
- * if not nt or not sym_isvar(f_sym[-1]): # <<<<<<<<<<<<<<
- * f_sym.append(sym_setindex(self.category, last_index + 2))
- * e_sym.append(sym_setindex(self.category, last_index + 2))
- */
- __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_7 = (!__pyx_t_14);
- if (!__pyx_t_7) {
- __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_f_sym), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_14 = (!__pyx_f_3_sa_sym_isvar(__pyx_t_9));
- __pyx_t_13 = __pyx_t_14;
- } else {
- __pyx_t_13 = __pyx_t_7;
- }
- if (__pyx_t_13) {
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2081
- * # [X] Rule [X]
- * if not nt or not sym_isvar(f_sym[-1]):
- * f_sym.append(sym_setindex(self.category, last_index + 2)) # <<<<<<<<<<<<<<
- * e_sym.append(sym_setindex(self.category, last_index + 2))
- * rules.append(self.new_rule(f_sym, e_sym, links))
- */
- __pyx_t_2 = PyNumber_Add(__pyx_v_last_index, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = PyList_Append(__pyx_v_f_sym, __pyx_t_2); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2082
- * if not nt or not sym_isvar(f_sym[-1]):
- * f_sym.append(sym_setindex(self.category, last_index + 2))
- * e_sym.append(sym_setindex(self.category, last_index + 2)) # <<<<<<<<<<<<<<
- * rules.append(self.new_rule(f_sym, e_sym, links))
- * return rules
- */
- __pyx_t_2 = PyNumber_Add(__pyx_v_last_index, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = PyList_Append(__pyx_v_e_sym, __pyx_t_2); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_L24:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2083
- * f_sym.append(sym_setindex(self.category, last_index + 2))
- * e_sym.append(sym_setindex(self.category, last_index + 2))
- * rules.append(self.new_rule(f_sym, e_sym, links)) # <<<<<<<<<<<<<<
- * return rules
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2047
+ * 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_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__new_rule); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __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_INCREF(((PyObject *)__pyx_v_e_sym));
- PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_e_sym));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_e_sym));
- __Pyx_INCREF(((PyObject *)__pyx_v_links));
- PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_links));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_links));
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __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 = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_t_10 = PyList_Append(__pyx_v_rules, __pyx_t_3); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- goto __pyx_L35;
- }
- __pyx_L35:;
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2084
- * e_sym.append(sym_setindex(self.category, last_index + 2))
- * rules.append(self.new_rule(f_sym, e_sym, links))
- * return rules # <<<<<<<<<<<<<<
- *
- * def new_rule(self, f_sym, e_sym, links):
- */
- __Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(((PyObject *)__pyx_v_rules));
- __pyx_r = ((PyObject *)__pyx_v_rules);
- goto __pyx_L0;
-
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_6);
- __Pyx_XDECREF(__pyx_t_12);
- __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rules", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XDECREF(__pyx_v_rules);
- __Pyx_XDECREF(__pyx_v_nt_inv);
- __Pyx_XDECREF(__pyx_v_f_sym);
- __Pyx_XDECREF(__pyx_v_off);
- __Pyx_XDECREF(__pyx_v_next_nt);
- __Pyx_XDECREF(__pyx_v_nt_len);
- __Pyx_XDECREF(__pyx_v_i);
- __Pyx_XDECREF(__pyx_v_e_sym);
- __Pyx_XDECREF(__pyx_v_links);
- __Pyx_XDECREF(__pyx_v_links_len);
- __Pyx_XDECREF(__pyx_v_nt_i);
- __Pyx_XDECREF(__pyx_v_last_index);
- __Pyx_XDECREF(__pyx_v_f_len);
- __Pyx_XDECREF(__pyx_v_e_len);
- __Pyx_XDECREF(__pyx_v_link);
- __Pyx_XDECREF(__pyx_v_sub);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* Python wrapper */
-static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_30new_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_30new_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- PyObject *__pyx_v_f_sym = 0;
- PyObject *__pyx_v_e_sym = 0;
- PyObject *__pyx_v_links = 0;
- PyObject *__pyx_r = 0;
- __Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("new_rule (wrapper)", 0);
- {
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f_sym,&__pyx_n_s__e_sym,&__pyx_n_s__links,0};
- PyObject* values[3] = {0,0,0};
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args;
- const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
- switch (pos_args) {
- case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
- case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
- case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
- case 0: break;
- default: goto __pyx_L5_argtuple_error;
- }
- kw_args = PyDict_Size(__pyx_kwds);
- switch (pos_args) {
- case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f_sym)) != 0)) kw_args--;
- else goto __pyx_L5_argtuple_error;
- case 1:
- if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e_sym)) != 0)) kw_args--;
- else {
- __Pyx_RaiseArgtupleInvalid("new_rule", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- case 2:
- if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__links)) != 0)) kw_args--;
- else {
- __Pyx_RaiseArgtupleInvalid("new_rule", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- }
- if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "new_rule") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
- goto __pyx_L5_argtuple_error;
- } else {
- values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
- values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
- values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
- }
- __pyx_v_f_sym = values[0];
- __pyx_v_e_sym = values[1];
- __pyx_v_links = values[2];
- }
- goto __pyx_L4_argument_unpacking_done;
- __pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("new_rule", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.new_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_29new_rule(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f_sym, __pyx_v_e_sym, __pyx_v_links);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_8new_rule_2generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_13) {
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2089
- * f = Phrase(f_sym)
- * e = Phrase(e_sym)
- * a = tuple(self.alignment.link(i, j) for (i, j) in links) # <<<<<<<<<<<<<<
- * return (f, e, a)
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2048
+ * 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)
*/
-
-static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8new_rule_genexpr(PyObject *__pyx_self) {
- struct __pyx_obj_3_sa___pyx_scope_struct_22_genexpr *__pyx_cur_scope;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("genexpr", 0);
- __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_22_genexpr *)__pyx_ptype_3_sa___pyx_scope_struct_22_genexpr->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_22_genexpr, __pyx_empty_tuple, NULL);
- if (unlikely(!__pyx_cur_scope)) {
- __Pyx_RefNannyFinishContext();
- return NULL;
- }
- __Pyx_GOTREF(__pyx_cur_scope);
- __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule *) __pyx_self;
- __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_3_sa_23HieroCachingRuleFactory_8new_rule_2generator14, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_cur_scope);
- __Pyx_RefNannyFinishContext();
- return (PyObject *) gen;
- }
-
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.new_rule.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_8new_rule_2generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
-{
- struct __pyx_obj_3_sa___pyx_scope_struct_22_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_22_genexpr *)__pyx_generator->closure);
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- Py_ssize_t __pyx_t_2;
- PyObject *(*__pyx_t_3)(PyObject *);
- PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = NULL;
- PyObject *__pyx_t_6 = NULL;
- PyObject *__pyx_t_7 = NULL;
- PyObject *(*__pyx_t_8)(PyObject *);
- int __pyx_t_9;
- int __pyx_t_10;
- __Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("None", 0);
- switch (__pyx_generator->resume_label) {
- case 0: goto __pyx_L3_first_run;
- case 1: goto __pyx_L8_resume_from_yield;
- default: /* CPython raises the right error here */
- __Pyx_RefNannyFinishContext();
- return NULL;
- }
- __pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_links) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_links)) {
- __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_links; __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_links); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
- }
- for (;;) {
- 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 = 2089; __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 = 2089; __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 = 2089; __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 = 2089; __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- break;
- }
- __Pyx_GOTREF(__pyx_t_4);
- }
- if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
- PyObject* sequence = __pyx_t_4;
- #if CYTHON_COMPILING_IN_CPYTHON
- Py_ssize_t size = Py_SIZE(sequence);
- #else
- Py_ssize_t size = PySequence_Size(sequence);
- #endif
- if (unlikely(size != 2)) {
- if (size > 2) __Pyx_RaiseTooManyValuesError(2);
- else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- #if CYTHON_COMPILING_IN_CPYTHON
- if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
- } else {
- __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
- }
- __Pyx_INCREF(__pyx_t_5);
- __Pyx_INCREF(__pyx_t_6);
- #else
- __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- } else
- {
- Py_ssize_t index = -1;
- __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
- index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_5);
- index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_6);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_8 = NULL;
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- goto __pyx_L7_unpacking_done;
- __pyx_L6_unpacking_failed:;
- __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_L7_unpacking_done:;
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __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); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __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); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __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); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __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 = 2048; __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 = 2048; __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 = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_v_lex_f_j);
+ __pyx_v_lex_f_j = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L25;
}
- __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_i);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_cur_scope->__pyx_v_i = __pyx_t_5;
- __pyx_t_5 = 0;
- __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_j);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_j);
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_j = __pyx_t_6;
- __pyx_t_6 = 0;
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = PyInt_FromLong(((struct __pyx_vtabstruct_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_9, __pyx_t_10)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 0;
- __Pyx_XGIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
- __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
- __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- /* return from generator, yielding value */
- __pyx_generator->resume_label = 1;
- return __pyx_r;
- __pyx_L8_resume_from_yield:;
- __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
- __pyx_cur_scope->__pyx_t_0 = 0;
- __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- PyErr_SetNone(PyExc_StopIteration);
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_5);
- __Pyx_XDECREF(__pyx_t_6);
- __Pyx_XDECREF(__pyx_t_7);
- __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_L0:;
- __Pyx_XDECREF(__pyx_r);
- __pyx_generator->resume_label = -1;
- __Pyx_Generator_clear((PyObject*)__pyx_generator);
- __Pyx_RefNannyFinishContext();
- return NULL;
-}
-
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2086
- * return rules
- *
- * def new_rule(self, f_sym, e_sym, links): # <<<<<<<<<<<<<<
- * f = Phrase(f_sym)
- * e = Phrase(e_sym)
- */
-
-static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_29new_rule(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_sym, PyObject *__pyx_v_e_sym, PyObject *__pyx_v_links) {
- struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule *__pyx_cur_scope;
- struct __pyx_obj_3_sa_Phrase *__pyx_v_f = NULL;
- struct __pyx_obj_3_sa_Phrase *__pyx_v_e = NULL;
- PyObject *__pyx_v_a = NULL;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("new_rule", 0);
- __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule *)__pyx_ptype_3_sa___pyx_scope_struct_21_new_rule->tp_new(__pyx_ptype_3_sa___pyx_scope_struct_21_new_rule, __pyx_empty_tuple, NULL);
- if (unlikely(!__pyx_cur_scope)) {
- __Pyx_RefNannyFinishContext();
- return NULL;
+ __pyx_L25:;
+ goto __pyx_L23;
}
- __Pyx_GOTREF(__pyx_cur_scope);
- __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
- __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- __pyx_cur_scope->__pyx_v_links = __pyx_v_links;
- __Pyx_INCREF(__pyx_cur_scope->__pyx_v_links);
- __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_links);
+ __pyx_L23:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2087
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2051
*
- * def new_rule(self, f_sym, e_sym, links):
+ * # 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 = 2087; __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 = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_INCREF(__pyx_v_f_sym);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_f_sym);
- __Pyx_GIVEREF(__pyx_v_f_sym);
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), 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_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_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __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_3_sa_Phrase *)__pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_v_f = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_3);
+ __pyx_t_3 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2088
- * def new_rule(self, f_sym, e_sym, links):
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2052
+ * # 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)
+ * return (f, e, a, lex_f_i, lex_f_j)
*/
- __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);
- __Pyx_INCREF(__pyx_v_e_sym);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_e_sym);
- __Pyx_GIVEREF(__pyx_v_e_sym);
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __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 = 2052; __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_3_sa_Phrase)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_e = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2089
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2053
* f = Phrase(f_sym)
* e = Phrase(e_sym)
* a = tuple(self.alignment.link(i, j) for (i, j) in links) # <<<<<<<<<<<<<<
- * return (f, e, a)
+ * return (f, e, a, lex_f_i, lex_f_j)
*
*/
- __pyx_t_1 = __pyx_pf_3_sa_23HieroCachingRuleFactory_8new_rule_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_pf_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __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_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __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 = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_a = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2090
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2054
* e = Phrase(e_sym)
* a = tuple(self.alignment.link(i, j) for (i, j) in links)
- * return (f, e, a) # <<<<<<<<<<<<<<
+ * return (f, e, a, lex_f_i, lex_f_j) # <<<<<<<<<<<<<<
*
- * def fmt_rule(self, f, e, a):
+ * # Rule string from rule
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __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 = 2054; __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));
@@ -62674,6 +62112,12 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_29new_rule(struct __pyx
__Pyx_INCREF(((PyObject *)__pyx_v_a));
PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_a));
__Pyx_GIVEREF(((PyObject *)__pyx_v_a));
+ __Pyx_INCREF(__pyx_v_lex_f_i);
+ PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_lex_f_i);
+ __Pyx_GIVEREF(__pyx_v_lex_f_i);
+ __Pyx_INCREF(__pyx_v_lex_f_j);
+ PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_lex_f_j);
+ __Pyx_GIVEREF(__pyx_v_lex_f_j);
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
@@ -62683,12 +62127,29 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_29new_rule(struct __pyx
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.new_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_12);
+ __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_nt_inv);
+ __Pyx_XDECREF(__pyx_v_f_sym);
+ __Pyx_XDECREF(__pyx_v_off);
+ __Pyx_XDECREF(__pyx_v_next_nt);
+ __Pyx_XDECREF(__pyx_v_nt_len);
+ __Pyx_XDECREF(__pyx_v_i);
+ __Pyx_XDECREF(__pyx_v_e_sym);
+ __Pyx_XDECREF(__pyx_v_links_inv);
+ __Pyx_XDECREF(__pyx_v_links_len);
+ __Pyx_XDECREF(__pyx_v_nt_i);
+ __Pyx_XDECREF(__pyx_v_lex_f_i);
+ __Pyx_XDECREF(__pyx_v_lex_f_j);
__Pyx_XDECREF((PyObject *)__pyx_v_f);
__Pyx_XDECREF((PyObject *)__pyx_v_e);
__Pyx_XDECREF(__pyx_v_a);
+ __Pyx_XDECREF(__pyx_v_sub);
+ __Pyx_XDECREF(__pyx_v_link);
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -62696,8 +62157,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_29new_rule(struct __pyx
}
/* Python wrapper */
-static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_32fmt_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_32fmt_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_30fmt_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_30fmt_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_f = 0;
PyObject *__pyx_v_e = 0;
PyObject *__pyx_v_a = 0;
@@ -62725,16 +62186,16 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_32fmt_rule(PyObject *__
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 = 2092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __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 = 2092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __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 = 2092; __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 = 2057; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -62749,20 +62210,20 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_32fmt_rule(PyObject *__
}
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 = 2092; __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 = 2057; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_sa.HieroCachingRuleFactory.fmt_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_31fmt_rule(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f, __pyx_v_e, __pyx_v_a);
+ __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_29fmt_rule(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f, __pyx_v_e, __pyx_v_a);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2093
- *
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2058
+ * # 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)
@@ -62787,7 +62248,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(PyObj
__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_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator15, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator15, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -62826,13 +62287,13 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator15(
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __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 = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __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 = 2058; __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 = 2093; __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 = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -62840,23 +62301,23 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator15(
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 = 2093; __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 = 2058; __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 = 2093; __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 = 2058; __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 = 2093; __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 = 2058; __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 = 2093; __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 = 2058; __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 = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -62867,24 +62328,24 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator15(
__Pyx_GIVEREF(__pyx_t_4);
__pyx_cur_scope->__pyx_v_packed = __pyx_t_4;
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_137), __pyx_n_s__format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_137), __pyx_n_s__format); 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);
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_5 = PyObject_GetAttr(((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 = 2093; __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 = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_5 = PyObject_GetAttr(((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 = 2058; __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 = 2093; __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 = 2058; __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 = 2093; __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 = 2058; __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 = 2093; __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 = 2058; __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 = 2093; __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 = 2058; __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;
@@ -62905,7 +62366,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator15(
__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 = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
PyErr_SetNone(PyExc_StopIteration);
@@ -62925,15 +62386,15 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator15(
return NULL;
}
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2092
- * return (f, e, a)
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2057
*
+ * # 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)
*/
-static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_31fmt_rule(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_a) {
+static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_29fmt_rule(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_a) {
struct __pyx_obj_3_sa___pyx_scope_struct_23_fmt_rule *__pyx_cur_scope;
PyObject *__pyx_v_a_str = NULL;
PyObject *__pyx_r = NULL;
@@ -62958,30 +62419,30 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_31fmt_rule(struct __pyx
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_a);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_a);
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2093
- *
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2058
+ * # 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 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_67), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_67), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __pyx_pf_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_pf_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __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 = 2093; __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 = 2058; __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 = 2093; __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 = 2058; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":2094
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2059
* 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) # <<<<<<<<<<<<<<
@@ -62989,9 +62450,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_31fmt_rule(struct __pyx
* # Debugging
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_138), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_138), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __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 = 2094; __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 = 2059; __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);
@@ -63002,7 +62463,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_31fmt_rule(struct __pyx
__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 = 2094; __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 = 2059; __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;
@@ -63027,17 +62488,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_31fmt_rule(struct __pyx
}
/* Python wrapper */
-static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_34dump_online_stats(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_34dump_online_stats(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_32dump_online_stats(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_32dump_online_stats(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("dump_online_stats (wrapper)", 0);
- __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_33dump_online_stats(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self));
+ __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_31dump_online_stats(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2097
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2062
*
* # Debugging
* def dump_online_stats(self): # <<<<<<<<<<<<<<
@@ -63045,11 +62506,11 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_34dump_online_stats(PyO
* logger.info(' Online Stats ')
*/
-static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_33dump_online_stats(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self) {
- PyObject *__pyx_v_ph = NULL;
- PyObject *__pyx_v_ph2 = NULL;
+static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_31dump_online_stats(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self) {
PyObject *__pyx_v_w = NULL;
PyObject *__pyx_v_w2 = NULL;
+ PyObject *__pyx_v_ph = NULL;
+ PyObject *__pyx_v_ph2 = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -63057,97 +62518,99 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_33dump_online_stats(str
Py_ssize_t __pyx_t_3;
PyObject *(*__pyx_t_4)(PyObject *);
PyObject *__pyx_t_5 = NULL;
- PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_6;
PyObject *__pyx_t_7 = NULL;
- Py_ssize_t __pyx_t_8;
- PyObject *(*__pyx_t_9)(PyObject *);
- PyObject *__pyx_t_10 = NULL;
- int __pyx_t_11;
+ PyObject *__pyx_t_8 = NULL;
+ Py_ssize_t __pyx_t_9;
+ PyObject *(*__pyx_t_10)(PyObject *);
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("dump_online_stats", 0);
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2098
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2063
* # Debugging
* def dump_online_stats(self):
* logger.info('------------------------------') # <<<<<<<<<<<<<<
* logger.info(' Online Stats ')
* logger.info('------------------------------')
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__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_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_140), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_140), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __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_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2099
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2064
* def dump_online_stats(self):
* logger.info('------------------------------')
* logger.info(' Online Stats ') # <<<<<<<<<<<<<<
* logger.info('------------------------------')
- * logger.info('F')
+ * logger.info('f')
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_142), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_142), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __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_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2100
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2065
* logger.info('------------------------------')
* logger.info(' Online Stats ')
* logger.info('------------------------------') # <<<<<<<<<<<<<<
- * logger.info('F')
- * for ph in self.phrases_f:
+ * logger.info('f')
+ * for w in self.bilex_f:
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__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_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_143), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_143), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __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_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2101
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2066
* logger.info(' Online Stats ')
* logger.info('------------------------------')
- * logger.info('F') # <<<<<<<<<<<<<<
- * for ph in self.phrases_f:
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph]))
+ * logger.info('f') # <<<<<<<<<<<<<<
+ * for w in self.bilex_f:
+ * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w]))
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_144), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_144), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __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_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2102
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2067
* logger.info('------------------------------')
- * logger.info('F')
- * for ph in self.phrases_f: # <<<<<<<<<<<<<<
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph]))
- * logger.info('E')
+ * logger.info('f')
+ * for w in self.bilex_f: # <<<<<<<<<<<<<<
+ * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w]))
+ * logger.info('e')
*/
- if (PyList_CheckExact(__pyx_v_self->phrases_f) || PyTuple_CheckExact(__pyx_v_self->phrases_f)) {
- __pyx_t_1 = __pyx_v_self->phrases_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
+ if (PyList_CheckExact(__pyx_v_self->bilex_f) || PyTuple_CheckExact(__pyx_v_self->bilex_f)) {
+ __pyx_t_1 = __pyx_v_self->bilex_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
- __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->phrases_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->bilex_f); if (unlikely(!__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_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -63155,111 +62618,106 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_33dump_online_stats(str
if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_2 = __pyx_t_4(__pyx_t_1);
if (unlikely(!__pyx_t_2)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_2);
}
- __Pyx_XDECREF(__pyx_v_ph);
- __pyx_v_ph = __pyx_t_2;
+ __Pyx_XDECREF(__pyx_v_w);
+ __pyx_v_w = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2103
- * logger.info('F')
- * for ph in self.phrases_f:
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph])) # <<<<<<<<<<<<<<
- * logger.info('E')
- * for ph in self.phrases_e:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2068
+ * logger.info('f')
+ * for w in self.bilex_f:
+ * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w])) # <<<<<<<<<<<<<<
+ * logger.info('e')
+ * for w in self.bilex_e:
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_v_ph);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ph);
- __Pyx_GIVEREF(__pyx_v_ph);
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_kp_s_145)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Add(__pyx_t_6, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_self->bilex_f, __pyx_v_w); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_GetItem(__pyx_v_self->phrases_f, __pyx_v_ph); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+ __pyx_t_8 = PyNumber_Add(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __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 = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
- __Pyx_GIVEREF(__pyx_t_7);
- __pyx_t_7 = 0;
- __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 = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2104
- * for ph in self.phrases_f:
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph]))
- * logger.info('E') # <<<<<<<<<<<<<<
- * for ph in self.phrases_e:
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph]))
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2069
+ * for w in self.bilex_f:
+ * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w]))
+ * logger.info('e') # <<<<<<<<<<<<<<
+ * for w in self.bilex_e:
+ * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w]))
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_145), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_146), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2105
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph]))
- * logger.info('E')
- * for ph in self.phrases_e: # <<<<<<<<<<<<<<
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph]))
- * logger.info('FE')
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2070
+ * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w]))
+ * logger.info('e')
+ * for w in self.bilex_e: # <<<<<<<<<<<<<<
+ * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w]))
+ * logger.info('fe')
*/
- if (PyList_CheckExact(__pyx_v_self->phrases_e) || PyTuple_CheckExact(__pyx_v_self->phrases_e)) {
- __pyx_t_1 = __pyx_v_self->phrases_e; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
+ if (PyList_CheckExact(__pyx_v_self->bilex_e) || PyTuple_CheckExact(__pyx_v_self->bilex_e)) {
+ __pyx_t_1 = __pyx_v_self->bilex_e; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
- __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->phrases_e); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->bilex_e); 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_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -63267,111 +62725,106 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_33dump_online_stats(str
if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_7 = __pyx_t_4(__pyx_t_1);
- if (unlikely(!__pyx_t_7)) {
+ __pyx_t_8 = __pyx_t_4(__pyx_t_1);
+ if (unlikely(!__pyx_t_8)) {
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 = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_8);
}
- __Pyx_XDECREF(__pyx_v_ph);
- __pyx_v_ph = __pyx_t_7;
- __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_v_w);
+ __pyx_v_w = __pyx_t_8;
+ __pyx_t_8 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2106
- * logger.info('E')
- * for ph in self.phrases_e:
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph])) # <<<<<<<<<<<<<<
- * logger.info('FE')
- * for ph in self.phrases_fe:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2071
+ * logger.info('e')
+ * for w in self.bilex_e:
+ * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w])) # <<<<<<<<<<<<<<
+ * logger.info('fe')
+ * for w in self.bilex_fe:
*/
- __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_6 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_INCREF(__pyx_v_ph);
- PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_ph);
- __Pyx_GIVEREF(__pyx_v_ph);
- __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+ __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_8), ((PyObject *)__pyx_kp_s_145)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_GetItem(__pyx_v_self->bilex_e, __pyx_v_w); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __pyx_t_7 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_GetItem(__pyx_v_self->phrases_e, __pyx_v_ph); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Add(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __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_5)); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2107
- * for ph in self.phrases_e:
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph]))
- * logger.info('FE') # <<<<<<<<<<<<<<
- * for ph in self.phrases_fe:
- * for ph2 in self.phrases_fe[ph]:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2072
+ * for w in self.bilex_e:
+ * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w]))
+ * logger.info('fe') # <<<<<<<<<<<<<<
+ * for w in self.bilex_fe:
+ * for w2 in self.bilex_fe[w]:
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); 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_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__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_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_146), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_147), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __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_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2108
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph]))
- * logger.info('FE')
- * for ph in self.phrases_fe: # <<<<<<<<<<<<<<
- * for ph2 in self.phrases_fe[ph]:
- * logger.info(str(ph) + ' ||| ' + str(ph2) + ' ||| ' + str(self.phrases_fe[ph][ph2]))
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2073
+ * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w]))
+ * logger.info('fe')
+ * for w in self.bilex_fe: # <<<<<<<<<<<<<<
+ * for w2 in self.bilex_fe[w]:
+ * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2]))
*/
- if (PyList_CheckExact(__pyx_v_self->phrases_fe) || PyTuple_CheckExact(__pyx_v_self->phrases_fe)) {
- __pyx_t_1 = __pyx_v_self->phrases_fe; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
+ if (PyList_CheckExact(__pyx_v_self->bilex_fe) || PyTuple_CheckExact(__pyx_v_self->bilex_fe)) {
+ __pyx_t_1 = __pyx_v_self->bilex_fe; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
- __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->phrases_fe); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->bilex_fe); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -63379,179 +62832,169 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_33dump_online_stats(str
if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_2 = __pyx_t_4(__pyx_t_1);
- if (unlikely(!__pyx_t_2)) {
+ __pyx_t_7 = __pyx_t_4(__pyx_t_1);
+ if (unlikely(!__pyx_t_7)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_7);
}
- __Pyx_XDECREF(__pyx_v_ph);
- __pyx_v_ph = __pyx_t_2;
- __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_v_w);
+ __pyx_v_w = __pyx_t_7;
+ __pyx_t_7 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2109
- * logger.info('FE')
- * for ph in self.phrases_fe:
- * for ph2 in self.phrases_fe[ph]: # <<<<<<<<<<<<<<
- * logger.info(str(ph) + ' ||| ' + str(ph2) + ' ||| ' + str(self.phrases_fe[ph][ph2]))
- * logger.info('f')
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2074
+ * logger.info('fe')
+ * for w in self.bilex_fe:
+ * for w2 in self.bilex_fe[w]: # <<<<<<<<<<<<<<
+ * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2]))
+ * logger.info('F')
*/
- __pyx_t_2 = PyObject_GetItem(__pyx_v_self->phrases_fe, __pyx_v_ph); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
- __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ __pyx_t_7 = PyObject_GetItem(__pyx_v_self->bilex_fe, __pyx_v_w); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
+ __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext;
+ __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext;
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_5)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
+ if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_8)) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_5)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+ } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_8)) {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_2 = __pyx_t_9(__pyx_t_5);
- if (unlikely(!__pyx_t_2)) {
+ __pyx_t_7 = __pyx_t_10(__pyx_t_8);
+ if (unlikely(!__pyx_t_7)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_7);
}
- __Pyx_XDECREF(__pyx_v_ph2);
- __pyx_v_ph2 = __pyx_t_2;
- __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_v_w2);
+ __pyx_v_w2 = __pyx_t_7;
+ __pyx_t_7 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2110
- * for ph in self.phrases_fe:
- * for ph2 in self.phrases_fe[ph]:
- * logger.info(str(ph) + ' ||| ' + str(ph2) + ' ||| ' + str(self.phrases_fe[ph][ph2])) # <<<<<<<<<<<<<<
- * logger.info('f')
- * for w in self.bilex_f:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2075
+ * for w in self.bilex_fe:
+ * for w2 in self.bilex_fe[w]:
+ * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2])) # <<<<<<<<<<<<<<
+ * logger.info('F')
+ * for ph in self.phrases_f:
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); 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_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__info); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(1); 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_INCREF(__pyx_v_ph);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ph);
- __Pyx_GIVEREF(__pyx_v_ph);
- __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Add(__pyx_t_7, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_INCREF(__pyx_v_ph2);
- PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_ph2);
- __Pyx_GIVEREF(__pyx_v_ph2);
- __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+ __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_7), ((PyObject *)__pyx_kp_s_145)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_10 = PyNumber_Add(__pyx_t_7, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = PyObject_GetItem(__pyx_v_self->phrases_fe, __pyx_v_ph); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_2 = PyObject_GetItem(__pyx_t_7, __pyx_v_ph2); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); 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_6 = __Pyx_PyInt_AsInt(__pyx_v_w2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+ __pyx_t_11 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __pyx_t_7 = PyNumber_Add(__pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(1); 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);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
- __Pyx_GIVEREF(__pyx_t_7);
- __pyx_t_7 = 0;
- __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyNumber_Add(__pyx_t_11, ((PyObject *)__pyx_kp_s_145)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = PyObject_GetItem(__pyx_v_self->bilex_fe, __pyx_v_w); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_5 = PyObject_GetItem(__pyx_t_11, __pyx_v_w2); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
+ __pyx_t_11 = PyNumber_Add(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11);
+ __Pyx_GIVEREF(__pyx_t_11);
+ __pyx_t_11 = 0;
+ __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
}
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2111
- * for ph2 in self.phrases_fe[ph]:
- * logger.info(str(ph) + ' ||| ' + str(ph2) + ' ||| ' + str(self.phrases_fe[ph][ph2]))
- * logger.info('f') # <<<<<<<<<<<<<<
- * for w in self.bilex_f:
- * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w]))
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2076
+ * for w2 in self.bilex_fe[w]:
+ * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2]))
+ * logger.info('F') # <<<<<<<<<<<<<<
+ * for ph in self.phrases_f:
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph]))
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_147), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_148), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2112
- * logger.info(str(ph) + ' ||| ' + str(ph2) + ' ||| ' + str(self.phrases_fe[ph][ph2]))
- * logger.info('f')
- * for w in self.bilex_f: # <<<<<<<<<<<<<<
- * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w]))
- * logger.info('e')
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2077
+ * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2]))
+ * logger.info('F')
+ * for ph in self.phrases_f: # <<<<<<<<<<<<<<
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph]))
+ * logger.info('E')
*/
- if (PyList_CheckExact(__pyx_v_self->bilex_f) || PyTuple_CheckExact(__pyx_v_self->bilex_f)) {
- __pyx_t_1 = __pyx_v_self->bilex_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
+ if (PyList_CheckExact(__pyx_v_self->phrases_f) || PyTuple_CheckExact(__pyx_v_self->phrases_f)) {
+ __pyx_t_1 = __pyx_v_self->phrases_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
- __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->bilex_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->phrases_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -63559,106 +63002,111 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_33dump_online_stats(str
if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_5 = __pyx_t_4(__pyx_t_1);
- if (unlikely(!__pyx_t_5)) {
+ __pyx_t_8 = __pyx_t_4(__pyx_t_1);
+ if (unlikely(!__pyx_t_8)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_8);
}
- __Pyx_XDECREF(__pyx_v_w);
- __pyx_v_w = __pyx_t_5;
- __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_v_ph);
+ __pyx_v_ph = __pyx_t_8;
+ __pyx_t_8 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2113
- * logger.info('f')
- * for w in self.bilex_f:
- * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w])) # <<<<<<<<<<<<<<
- * logger.info('e')
- * for w in self.bilex_e:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2078
+ * logger.info('F')
+ * for ph in self.phrases_f:
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph])) # <<<<<<<<<<<<<<
+ * logger.info('E')
+ * for ph in self.phrases_e:
*/
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_11 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_INCREF(__pyx_v_ph);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_ph);
+ __Pyx_GIVEREF(__pyx_v_ph);
+ __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+ __pyx_t_8 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_5 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_11)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
- __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_kp_s_148)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_GetItem(__pyx_v_self->bilex_f, __pyx_v_w); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetItem(__pyx_v_self->phrases_f, __pyx_v_ph); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __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 = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_2 = PyNumber_Add(__pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2114
- * for w in self.bilex_f:
- * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w]))
- * logger.info('e') # <<<<<<<<<<<<<<
- * for w in self.bilex_e:
- * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w]))
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2079
+ * for ph in self.phrases_f:
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph]))
+ * logger.info('E') # <<<<<<<<<<<<<<
+ * for ph in self.phrases_e:
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph]))
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); 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_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __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_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_149), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_149), NULL); 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_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2115
- * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w]))
- * logger.info('e')
- * for w in self.bilex_e: # <<<<<<<<<<<<<<
- * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w]))
- * logger.info('fe')
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2080
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph]))
+ * logger.info('E')
+ * for ph in self.phrases_e: # <<<<<<<<<<<<<<
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph]))
+ * logger.info('FE')
*/
- if (PyList_CheckExact(__pyx_v_self->bilex_e) || PyTuple_CheckExact(__pyx_v_self->bilex_e)) {
- __pyx_t_1 = __pyx_v_self->bilex_e; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
+ if (PyList_CheckExact(__pyx_v_self->phrases_e) || PyTuple_CheckExact(__pyx_v_self->phrases_e)) {
+ __pyx_t_1 = __pyx_v_self->phrases_e; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
- __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->bilex_e); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->phrases_e); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -63666,106 +63114,111 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_33dump_online_stats(str
if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_6 = __pyx_t_4(__pyx_t_1);
- if (unlikely(!__pyx_t_6)) {
+ __pyx_t_2 = __pyx_t_4(__pyx_t_1);
+ if (unlikely(!__pyx_t_2)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_2);
}
- __Pyx_XDECREF(__pyx_v_w);
- __pyx_v_w = __pyx_t_6;
- __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_v_ph);
+ __pyx_v_ph = __pyx_t_2;
+ __pyx_t_2 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2116
- * logger.info('e')
- * for w in self.bilex_e:
- * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w])) # <<<<<<<<<<<<<<
- * logger.info('fe')
- * for w in self.bilex_fe:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2081
+ * logger.info('E')
+ * for ph in self.phrases_e:
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph])) # <<<<<<<<<<<<<<
+ * logger.info('FE')
+ * for ph in self.phrases_fe:
*/
- __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_11)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_6), ((PyObject *)__pyx_kp_s_148)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_GetItem(__pyx_v_self->bilex_e, __pyx_v_w); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_v_ph);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ph);
+ __Pyx_GIVEREF(__pyx_v_ph);
+ __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Add(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __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 = 2116; __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_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Add(__pyx_t_11, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = PyObject_GetItem(__pyx_v_self->phrases_e, __pyx_v_ph); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_11);
+ __Pyx_GIVEREF(__pyx_t_11);
+ __pyx_t_11 = 0;
+ __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+ __pyx_t_8 = PyNumber_Add(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2117
- * for w in self.bilex_e:
- * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w]))
- * logger.info('fe') # <<<<<<<<<<<<<<
- * for w in self.bilex_fe:
- * for w2 in self.bilex_fe[w]:
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2082
+ * for ph in self.phrases_e:
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph]))
+ * logger.info('FE') # <<<<<<<<<<<<<<
+ * for ph in self.phrases_fe:
+ * for ph2 in self.phrases_fe[ph]:
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_150), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_150), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __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_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2118
- * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w]))
- * logger.info('fe')
- * for w in self.bilex_fe: # <<<<<<<<<<<<<<
- * for w2 in self.bilex_fe[w]:
- * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2]))
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2083
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph]))
+ * logger.info('FE')
+ * for ph in self.phrases_fe: # <<<<<<<<<<<<<<
+ * for ph2 in self.phrases_fe[ph]:
+ * logger.info(self.fmt_rule(str(ph), str(ph2), self.phrases_al[ph][ph2]) + ' ||| ' + str(self.phrases_fe[ph][ph2]))
*/
- if (PyList_CheckExact(__pyx_v_self->bilex_fe) || PyTuple_CheckExact(__pyx_v_self->bilex_fe)) {
- __pyx_t_1 = __pyx_v_self->bilex_fe; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
+ if (PyList_CheckExact(__pyx_v_self->phrases_fe) || PyTuple_CheckExact(__pyx_v_self->phrases_fe)) {
+ __pyx_t_1 = __pyx_v_self->phrases_fe; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
- __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->bilex_fe); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->phrases_fe); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -63773,137 +63226,162 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_33dump_online_stats(str
if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_2 = __pyx_t_4(__pyx_t_1);
- if (unlikely(!__pyx_t_2)) {
+ __pyx_t_8 = __pyx_t_4(__pyx_t_1);
+ if (unlikely(!__pyx_t_8)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_8);
}
- __Pyx_XDECREF(__pyx_v_w);
- __pyx_v_w = __pyx_t_2;
- __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_v_ph);
+ __pyx_v_ph = __pyx_t_8;
+ __pyx_t_8 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2119
- * logger.info('fe')
- * for w in self.bilex_fe:
- * for w2 in self.bilex_fe[w]: # <<<<<<<<<<<<<<
- * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2]))
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2084
+ * logger.info('FE')
+ * for ph in self.phrases_fe:
+ * for ph2 in self.phrases_fe[ph]: # <<<<<<<<<<<<<<
+ * logger.info(self.fmt_rule(str(ph), str(ph2), self.phrases_al[ph][ph2]) + ' ||| ' + str(self.phrases_fe[ph][ph2]))
*
*/
- __pyx_t_2 = PyObject_GetItem(__pyx_v_self->bilex_fe, __pyx_v_w); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
- __pyx_t_6 = __pyx_t_2; __Pyx_INCREF(__pyx_t_6); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ __pyx_t_8 = PyObject_GetItem(__pyx_v_self->phrases_fe, __pyx_v_ph); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) {
+ __pyx_t_11 = __pyx_t_8; __Pyx_INCREF(__pyx_t_11); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext;
+ __pyx_t_9 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_10 = Py_TYPE(__pyx_t_11)->tp_iternext;
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_6)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_6)) break;
+ if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_11)) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_11)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PySequence_ITEM(__pyx_t_11, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_6)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
+ } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_11)) {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PySequence_ITEM(__pyx_t_11, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
- __pyx_t_2 = __pyx_t_9(__pyx_t_6);
- if (unlikely(!__pyx_t_2)) {
+ __pyx_t_8 = __pyx_t_10(__pyx_t_11);
+ if (unlikely(!__pyx_t_8)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_8);
}
- __Pyx_XDECREF(__pyx_v_w2);
- __pyx_v_w2 = __pyx_t_2;
- __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_v_ph2);
+ __pyx_v_ph2 = __pyx_t_8;
+ __pyx_t_8 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2120
- * for w in self.bilex_fe:
- * for w2 in self.bilex_fe[w]:
- * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2])) # <<<<<<<<<<<<<<
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2085
+ * for ph in self.phrases_fe:
+ * for ph2 in self.phrases_fe[ph]:
+ * logger.info(self.fmt_rule(str(ph), str(ph2), self.phrases_al[ph][ph2]) + ' ||| ' + str(self.phrases_fe[ph][ph2])) # <<<<<<<<<<<<<<
*
* # Spans are _inclusive_ on both ends [i, j]
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); 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_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_11)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_kp_s_148)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__fmt_rule); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_v_ph);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ph);
+ __Pyx_GIVEREF(__pyx_v_ph);
+ __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_w2); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_11)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_t_10 = PyNumber_Add(__pyx_t_7, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_v_ph2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ph2);
+ __Pyx_GIVEREF(__pyx_v_ph2);
+ __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Add(__pyx_t_10, ((PyObject *)__pyx_kp_s_148)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_self->phrases_al, __pyx_v_ph); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_10 = PyObject_GetItem(__pyx_v_self->bilex_fe, __pyx_v_w); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_7 = PyObject_GetItem(__pyx_t_10, __pyx_v_w2); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7);
+ __pyx_t_13 = PyObject_GetItem(__pyx_t_2, __pyx_v_ph2); if (!__pyx_t_13) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
__Pyx_GIVEREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_12);
+ PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_13);
+ __Pyx_GIVEREF(__pyx_t_13);
__pyx_t_7 = 0;
- __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
- __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_12 = 0;
+ __pyx_t_13 = 0;
+ __pyx_t_13 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_2 = PyNumber_Add(__pyx_t_13, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __pyx_t_13 = PyObject_GetItem(__pyx_v_self->phrases_fe, __pyx_v_ph); if (!__pyx_t_13) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __pyx_t_8 = PyObject_GetItem(__pyx_t_13, __pyx_v_ph2); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ __pyx_t_8 = 0;
+ __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
+ __pyx_t_13 = PyNumber_Add(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
- __pyx_t_10 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_13);
+ __Pyx_GIVEREF(__pyx_t_13);
+ __pyx_t_13 = 0;
+ __pyx_t_13 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -63913,16 +63391,18 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_33dump_online_stats(str
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
- __Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
- __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_12);
+ __Pyx_XDECREF(__pyx_t_13);
__Pyx_AddTraceback("_sa.HieroCachingRuleFactory.dump_online_stats", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
- __Pyx_XDECREF(__pyx_v_ph);
- __Pyx_XDECREF(__pyx_v_ph2);
__Pyx_XDECREF(__pyx_v_w);
__Pyx_XDECREF(__pyx_v_w2);
+ __Pyx_XDECREF(__pyx_v_ph);
+ __Pyx_XDECREF(__pyx_v_ph2);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -63959,16 +63439,16 @@ static PyObject *__pyx_pw_3_sa_13span_check(PyObject *__pyx_self, PyObject *__py
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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __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 = 2124; __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 = 2088; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -63983,7 +63463,7 @@ static PyObject *__pyx_pw_3_sa_13span_check(PyObject *__pyx_self, PyObject *__py
}
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 = 2124; __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 = 2088; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_sa.span_check", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -63994,9 +63474,9 @@ static PyObject *__pyx_pw_3_sa_13span_check(PyObject *__pyx_self, PyObject *__py
return __pyx_r;
}
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2124
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2088
+ *
* # Spans are _inclusive_ on both ends [i, j]
- * # Could be more efficient but probably not a bottleneck
* def span_check(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
@@ -64013,8 +63493,8 @@ static PyObject *__pyx_pf_3_sa_12span_check(CYTHON_UNUSED PyObject *__pyx_self,
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("span_check", 0);
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2125
- * # Could be more efficient but probably not a bottleneck
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2089
+ * # Spans are _inclusive_ on both ends [i, j]
* def span_check(vec, i, j):
* k = i # <<<<<<<<<<<<<<
* while k <= j:
@@ -64023,7 +63503,7 @@ static PyObject *__pyx_pf_3_sa_12span_check(CYTHON_UNUSED PyObject *__pyx_self,
__Pyx_INCREF(__pyx_v_i);
__pyx_v_k = __pyx_v_i;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2126
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2090
* def span_check(vec, i, j):
* k = i
* while k <= j: # <<<<<<<<<<<<<<
@@ -64031,25 +63511,25 @@ static PyObject *__pyx_pf_3_sa_12span_check(CYTHON_UNUSED PyObject *__pyx_self,
* 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 = 2126; __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 = 2126; __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 = 2090; __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 = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_2) break;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2127
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2091
* 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 = 2127; __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 = 2091; __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 = 2127; __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 = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2128
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2092
* while k <= j:
* if vec[k]:
* return False # <<<<<<<<<<<<<<
@@ -64057,7 +63537,7 @@ static PyObject *__pyx_pf_3_sa_12span_check(CYTHON_UNUSED PyObject *__pyx_self,
* 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 = 2128; __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 = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -64066,29 +63546,29 @@ static PyObject *__pyx_pf_3_sa_12span_check(CYTHON_UNUSED PyObject *__pyx_self,
}
__pyx_L5:;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2129
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2093
* 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 = 2129; __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 = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_v_k);
__pyx_v_k = __pyx_t_1;
__pyx_t_1 = 0;
}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2130
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2094
* return False
* k += 1
* return True # <<<<<<<<<<<<<<
*
- * def span_flip(vec, i, j):
+ * 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 = 2130; __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 = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -64108,15 +63588,15 @@ static PyObject *__pyx_pf_3_sa_12span_check(CYTHON_UNUSED PyObject *__pyx_self,
}
/* Python wrapper */
-static PyObject *__pyx_pw_3_sa_15span_flip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_3_sa_15span_flip = {__Pyx_NAMESTR("span_flip"), (PyCFunction)__pyx_pw_3_sa_15span_flip, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_3_sa_15span_flip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_3_sa_15span_inc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_3_sa_15span_inc = {__Pyx_NAMESTR("span_inc"), (PyCFunction)__pyx_pw_3_sa_15span_inc, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_3_sa_15span_inc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_vec = 0;
PyObject *__pyx_v_i = 0;
PyObject *__pyx_v_j = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("span_flip (wrapper)", 0);
+ __Pyx_RefNannySetupContext("span_inc (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vec,&__pyx_n_s__i,&__pyx_n_s__j,0};
PyObject* values[3] = {0,0,0};
@@ -64138,16 +63618,16 @@ static PyObject *__pyx_pw_3_sa_15span_flip(PyObject *__pyx_self, PyObject *__pyx
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("span_flip", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __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_flip", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __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_flip") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __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 = 2096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -64162,84 +63642,245 @@ static PyObject *__pyx_pw_3_sa_15span_flip(PyObject *__pyx_self, PyObject *__pyx
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("span_flip", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __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 = 2096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
- __Pyx_AddTraceback("_sa.span_flip", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("_sa.span_inc", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_3_sa_14span_flip(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j);
+ __pyx_r = __pyx_pf_3_sa_14span_inc(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2132
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2096
* return True
*
- * def span_flip(vec, i, j): # <<<<<<<<<<<<<<
+ * def span_inc(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
-static PyObject *__pyx_pf_3_sa_14span_flip(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) {
+static PyObject *__pyx_pf_3_sa_14span_inc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) {
PyObject *__pyx_v_k = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("span_flip", 0);
+ __Pyx_RefNannySetupContext("span_inc", 0);
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2133
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2097
*
- * def span_flip(vec, i, j):
+ * def span_inc(vec, i, j):
* k = i # <<<<<<<<<<<<<<
* while k <= j:
- * vec[k] = ~vec[k]
+ * vec[k] += 1
*/
__Pyx_INCREF(__pyx_v_i);
__pyx_v_k = __pyx_v_i;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2134
- * def span_flip(vec, i, j):
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2098
+ * def span_inc(vec, i, j):
* k = i
* while k <= j: # <<<<<<<<<<<<<<
- * vec[k] = ~vec[k]
+ * vec[k] += 1
* 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 = 2134; __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 = 2134; __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 = 2098; __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 = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_2) break;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2135
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2099
* k = i
* while k <= j:
- * vec[k] = ~vec[k] # <<<<<<<<<<<<<<
+ * vec[k] += 1 # <<<<<<<<<<<<<<
* k += 1
+ *
*/
- __pyx_t_1 = PyObject_GetItem(__pyx_v_vec, __pyx_v_k); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyNumber_Invert(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetItem(__pyx_v_vec, __pyx_v_k, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __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 = 2099; __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 = 2099; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":2136
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2100
* while k <= j:
- * vec[k] = ~vec[k]
+ * 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 = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_v_k);
+ __pyx_v_k = __pyx_t_1;
+ __pyx_t_1 = 0;
+ }
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("_sa.span_inc", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_k);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3_sa_17span_dec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_3_sa_17span_dec = {__Pyx_NAMESTR("span_dec"), (PyCFunction)__pyx_pw_3_sa_17span_dec, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_3_sa_17span_dec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_vec = 0;
+ PyObject *__pyx_v_i = 0;
+ PyObject *__pyx_v_j = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("span_dec (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vec,&__pyx_n_s__i,&__pyx_n_s__j,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vec)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ 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 = 2102; __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 = 2102; __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 = 2102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v_vec = values[0];
+ __pyx_v_i = values[1];
+ __pyx_v_j = values[2];
+ }
+ 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 = 2102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_sa.span_dec", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3_sa_16span_dec(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2102
+ * k += 1
+ *
+ * def span_dec(vec, i, j): # <<<<<<<<<<<<<<
+ * k = i
+ * while k <= j:
+ */
+
+static PyObject *__pyx_pf_3_sa_16span_dec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) {
+ PyObject *__pyx_v_k = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("span_dec", 0);
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2103
+ *
+ * def span_dec(vec, i, j):
+ * k = i # <<<<<<<<<<<<<<
+ * while k <= j:
+ * vec[k] -= 1
*/
- __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(__pyx_v_i);
+ __pyx_v_k = __pyx_v_i;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2104
+ * def span_dec(vec, i, j):
+ * k = i
+ * while k <= j: # <<<<<<<<<<<<<<
+ * vec[k] -= 1
+ * 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 = 2104; __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 = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (!__pyx_t_2) break;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2105
+ * k = i
+ * while k <= j:
+ * vec[k] -= 1 # <<<<<<<<<<<<<<
+ * k += 1
+ */
+ __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 = 2105; __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 = 2105; __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 = 2105; __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/m/workspace/cdec/python/src/sa/rulefactory.pxi":2106
+ * 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 = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_v_k);
- __pyx_v_k = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_v_k = __pyx_t_1;
+ __pyx_t_1 = 0;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -64247,7 +63888,8 @@ static PyObject *__pyx_pf_3_sa_14span_flip(CYTHON_UNUSED PyObject *__pyx_self, P
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_AddTraceback("_sa.span_flip", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("_sa.span_dec", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_k);
@@ -70279,10 +69921,9 @@ static PyMethodDef __pyx_methods_3_sa_HieroCachingRuleFactory[] = {
{__Pyx_NAMESTR("get_next_states"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_21get_next_states, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
{__Pyx_NAMESTR("input"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_23input, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3_sa_23HieroCachingRuleFactory_22input)},
{__Pyx_NAMESTR("add_instance"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_26add_instance, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("form_rules"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rules, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("new_rule"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_30new_rule, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("fmt_rule"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_32fmt_rule, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("dump_online_stats"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_34dump_online_stats, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("form_rule"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rule, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("fmt_rule"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_30fmt_rule, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("dump_online_stats"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_32dump_online_stats, METH_NOARGS, __Pyx_DOCSTR(0)},
{0, 0, 0, 0}
};
@@ -75099,12 +74740,14 @@ static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_20_add_instance(PyTypeObje
if (!o) return 0;
p = ((struct __pyx_obj_3_sa___pyx_scope_struct_20_add_instance *)o);
p->__pyx_v_al = 0;
- p->__pyx_v_al_span = 0;
p->__pyx_v_cover = 0;
+ p->__pyx_v_e_nt_cover = 0;
p->__pyx_v_e_words = 0;
+ p->__pyx_v_ef_span = 0;
p->__pyx_v_extract = 0;
p->__pyx_v_f_len = 0;
p->__pyx_v_f_words = 0;
+ p->__pyx_v_fe_span = 0;
p->__pyx_v_rules = 0;
p->__pyx_v_self = 0;
return o;
@@ -75113,12 +74756,14 @@ static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_20_add_instance(PyTypeObje
static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_20_add_instance(PyObject *o) {
struct __pyx_obj_3_sa___pyx_scope_struct_20_add_instance *p = (struct __pyx_obj_3_sa___pyx_scope_struct_20_add_instance *)o;
Py_CLEAR(p->__pyx_v_al);
- Py_CLEAR(p->__pyx_v_al_span);
Py_CLEAR(p->__pyx_v_cover);
+ Py_CLEAR(p->__pyx_v_e_nt_cover);
Py_CLEAR(p->__pyx_v_e_words);
+ Py_CLEAR(p->__pyx_v_ef_span);
Py_CLEAR(p->__pyx_v_extract);
Py_CLEAR(p->__pyx_v_f_len);
Py_CLEAR(p->__pyx_v_f_words);
+ Py_CLEAR(p->__pyx_v_fe_span);
Py_CLEAR(p->__pyx_v_rules);
Py_CLEAR(p->__pyx_v_self);
(*Py_TYPE(o)->tp_free)(o);
@@ -75130,15 +74775,18 @@ static int __pyx_tp_traverse_3_sa___pyx_scope_struct_20_add_instance(PyObject *o
if (p->__pyx_v_al) {
e = (*v)(p->__pyx_v_al, a); if (e) return e;
}
- if (p->__pyx_v_al_span) {
- e = (*v)(p->__pyx_v_al_span, a); if (e) return e;
- }
if (p->__pyx_v_cover) {
e = (*v)(p->__pyx_v_cover, a); if (e) return e;
}
+ if (p->__pyx_v_e_nt_cover) {
+ e = (*v)(p->__pyx_v_e_nt_cover, a); if (e) return e;
+ }
if (p->__pyx_v_e_words) {
e = (*v)(p->__pyx_v_e_words, a); if (e) return e;
}
+ if (p->__pyx_v_ef_span) {
+ e = (*v)(p->__pyx_v_ef_span, a); if (e) return e;
+ }
if (p->__pyx_v_extract) {
e = (*v)(p->__pyx_v_extract, a); if (e) return e;
}
@@ -75148,6 +74796,9 @@ static int __pyx_tp_traverse_3_sa___pyx_scope_struct_20_add_instance(PyObject *o
if (p->__pyx_v_f_words) {
e = (*v)(p->__pyx_v_f_words, a); if (e) return e;
}
+ if (p->__pyx_v_fe_span) {
+ e = (*v)(p->__pyx_v_fe_span, a); if (e) return e;
+ }
if (p->__pyx_v_rules) {
e = (*v)(p->__pyx_v_rules, a); if (e) return e;
}
@@ -75163,15 +74814,18 @@ static int __pyx_tp_clear_3_sa___pyx_scope_struct_20_add_instance(PyObject *o) {
tmp = ((PyObject*)p->__pyx_v_al);
p->__pyx_v_al = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_al_span);
- p->__pyx_v_al_span = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_cover);
p->__pyx_v_cover = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_e_nt_cover);
+ p->__pyx_v_e_nt_cover = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_e_words);
p->__pyx_v_e_words = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_ef_span);
+ p->__pyx_v_ef_span = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_extract);
p->__pyx_v_extract = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
@@ -75181,6 +74835,9 @@ static int __pyx_tp_clear_3_sa___pyx_scope_struct_20_add_instance(PyObject *o) {
tmp = ((PyObject*)p->__pyx_v_f_words);
p->__pyx_v_f_words = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_fe_span);
+ p->__pyx_v_fe_span = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_rules);
p->__pyx_v_rules = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
@@ -75348,26 +75005,26 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_20_add_instance = {
#endif
};
-static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_21_new_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule *p;
+static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_21_form_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
- p = ((struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule *)o);
+ p = ((struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule *)o);
p->__pyx_v_links = 0;
p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_21_new_rule(PyObject *o) {
- struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule *p = (struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule *)o;
+static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_21_form_rule(PyObject *o) {
+ struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule *p = (struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule *)o;
Py_CLEAR(p->__pyx_v_links);
Py_CLEAR(p->__pyx_v_self);
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_3_sa___pyx_scope_struct_21_new_rule(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_3_sa___pyx_scope_struct_21_form_rule(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule *p = (struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule *)o;
+ struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule *p = (struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule *)o;
if (p->__pyx_v_links) {
e = (*v)(p->__pyx_v_links, a); if (e) return e;
}
@@ -75377,8 +75034,8 @@ static int __pyx_tp_traverse_3_sa___pyx_scope_struct_21_new_rule(PyObject *o, vi
return 0;
}
-static int __pyx_tp_clear_3_sa___pyx_scope_struct_21_new_rule(PyObject *o) {
- struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule *p = (struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule *)o;
+static int __pyx_tp_clear_3_sa___pyx_scope_struct_21_form_rule(PyObject *o) {
+ struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule *p = (struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_links);
p->__pyx_v_links = Py_None; Py_INCREF(Py_None);
@@ -75389,11 +75046,11 @@ static int __pyx_tp_clear_3_sa___pyx_scope_struct_21_new_rule(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_21_new_rule[] = {
+static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_21_form_rule[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_21_new_rule = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_21_form_rule = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -75451,7 +75108,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_21_new_rule = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_21_new_rule = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_21_form_rule = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -75464,13 +75121,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_21_new_rule = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_21_new_rule = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_21_form_rule = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_21_new_rule = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_21_form_rule = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -75491,12 +75148,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_21_new_rule = {
#endif
};
-static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_21_new_rule = {
+static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_21_form_rule = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_sa.__pyx_scope_struct_21_new_rule"), /*tp_name*/
- sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule), /*tp_basicsize*/
+ __Pyx_NAMESTR("_sa.__pyx_scope_struct_21_form_rule"), /*tp_name*/
+ sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_3_sa___pyx_scope_struct_21_new_rule, /*tp_dealloc*/
+ __pyx_tp_dealloc_3_sa___pyx_scope_struct_21_form_rule, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -75506,24 +75163,24 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_21_new_rule = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_21_new_rule, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_21_new_rule, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_21_new_rule, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_21_form_rule, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_21_form_rule, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_21_form_rule, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer___pyx_scope_struct_21_new_rule, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_21_form_rule, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_3_sa___pyx_scope_struct_21_new_rule, /*tp_traverse*/
- __pyx_tp_clear_3_sa___pyx_scope_struct_21_new_rule, /*tp_clear*/
+ __pyx_tp_traverse_3_sa___pyx_scope_struct_21_form_rule, /*tp_traverse*/
+ __pyx_tp_clear_3_sa___pyx_scope_struct_21_form_rule, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_3_sa___pyx_scope_struct_21_new_rule, /*tp_methods*/
+ __pyx_methods_3_sa___pyx_scope_struct_21_form_rule, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -75533,7 +75190,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_21_new_rule = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_3_sa___pyx_scope_struct_21_new_rule, /*tp_new*/
+ __pyx_tp_new_3_sa___pyx_scope_struct_21_form_rule, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -75590,7 +75247,7 @@ static int __pyx_tp_clear_3_sa___pyx_scope_struct_22_genexpr(PyObject *o) {
struct __pyx_obj_3_sa___pyx_scope_struct_22_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_22_genexpr *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_21_new_rule *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_21_form_rule *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_i);
p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
@@ -76814,7 +76471,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_139, __pyx_k_139, sizeof(__pyx_k_139), 0, 0, 1, 0},
{&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
{&__pyx_kp_s_141, __pyx_k_141, sizeof(__pyx_k_141), 0, 0, 1, 0},
- {&__pyx_kp_s_148, __pyx_k_148, sizeof(__pyx_k_148), 0, 0, 1, 0},
+ {&__pyx_kp_s_145, __pyx_k_145, sizeof(__pyx_k_145), 0, 0, 1, 0},
{&__pyx_kp_s_151, __pyx_k_151, sizeof(__pyx_k_151), 0, 0, 1, 0},
{&__pyx_kp_s_154, __pyx_k_154, sizeof(__pyx_k_154), 0, 0, 1, 0},
{&__pyx_kp_s_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 0, 1, 0},
@@ -76913,7 +76570,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__col, __pyx_k__col, sizeof(__pyx_k__col), 0, 0, 1, 1},
{&__pyx_n_s__collect, __pyx_k__collect, sizeof(__pyx_k__collect), 0, 0, 1, 1},
{&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1},
- {&__pyx_n_s__collision, __pyx_k__collision, sizeof(__pyx_k__collision), 0, 0, 1, 1},
{&__pyx_n_s__curr_idx, __pyx_k__curr_idx, sizeof(__pyx_k__curr_idx), 0, 0, 1, 1},
{&__pyx_n_s__debug, __pyx_k__debug, sizeof(__pyx_k__debug), 0, 0, 1, 1},
{&__pyx_n_s__decode_lattice, __pyx_k__decode_lattice, sizeof(__pyx_k__decode_lattice), 0, 0, 1, 1},
@@ -76925,7 +76581,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__e_i, __pyx_k__e_i, sizeof(__pyx_k__e_i), 0, 0, 1, 1},
{&__pyx_n_s__e_j, __pyx_k__e_j, sizeof(__pyx_k__e_j), 0, 0, 1, 1},
{&__pyx_n_s__e_span, __pyx_k__e_span, sizeof(__pyx_k__e_span), 0, 0, 1, 1},
- {&__pyx_n_s__e_sym, __pyx_k__e_sym, sizeof(__pyx_k__e_sym), 0, 0, 1, 1},
{&__pyx_n_s__e_text, __pyx_k__e_text, sizeof(__pyx_k__e_text), 0, 0, 1, 1},
{&__pyx_n_s__e_words, __pyx_k__e_words, sizeof(__pyx_k__e_words), 0, 0, 1, 1},
{&__pyx_n_s__earray, __pyx_k__earray, sizeof(__pyx_k__earray), 0, 0, 1, 1},
@@ -76942,14 +76597,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__f_i, __pyx_k__f_i, sizeof(__pyx_k__f_i), 0, 0, 1, 1},
{&__pyx_n_s__f_j, __pyx_k__f_j, sizeof(__pyx_k__f_j), 0, 0, 1, 1},
{&__pyx_n_s__f_span, __pyx_k__f_span, sizeof(__pyx_k__f_span), 0, 0, 1, 1},
- {&__pyx_n_s__f_sym, __pyx_k__f_sym, sizeof(__pyx_k__f_sym), 0, 0, 1, 1},
{&__pyx_n_s__f_text, __pyx_k__f_text, sizeof(__pyx_k__f_text), 0, 0, 1, 1},
{&__pyx_n_s__f_words, __pyx_k__f_words, sizeof(__pyx_k__f_words), 0, 0, 1, 1},
{&__pyx_n_s__fcount, __pyx_k__fcount, sizeof(__pyx_k__fcount), 0, 0, 1, 1},
{&__pyx_n_s__fe, __pyx_k__fe, sizeof(__pyx_k__fe), 0, 0, 1, 1},
{&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1},
{&__pyx_n_s__fmt_rule, __pyx_k__fmt_rule, sizeof(__pyx_k__fmt_rule), 0, 0, 1, 1},
- {&__pyx_n_s__form_rules, __pyx_k__form_rules, sizeof(__pyx_k__form_rules), 0, 0, 1, 1},
+ {&__pyx_n_s__form_rule, __pyx_k__form_rule, sizeof(__pyx_k__form_rule), 0, 0, 1, 1},
{&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
{&__pyx_n_s__fphrase, __pyx_k__fphrase, sizeof(__pyx_k__fphrase), 0, 0, 1, 1},
{&__pyx_n_s__from_binary, __pyx_k__from_binary, sizeof(__pyx_k__from_binary), 0, 0, 1, 1},
@@ -77016,15 +76670,17 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__max_target_length, __pyx_k__max_target_length, sizeof(__pyx_k__max_target_length), 0, 0, 1, 1},
{&__pyx_n_s__merge, __pyx_k__merge, sizeof(__pyx_k__merge), 0, 0, 1, 1},
{&__pyx_n_s__meta, __pyx_k__meta, sizeof(__pyx_k__meta), 0, 0, 1, 1},
+ {&__pyx_n_s__min_bound, __pyx_k__min_bound, sizeof(__pyx_k__min_bound), 0, 0, 1, 1},
{&__pyx_n_s__min_dist, __pyx_k__min_dist, sizeof(__pyx_k__min_dist), 0, 0, 1, 1},
{&__pyx_n_s__min_gap_size, __pyx_k__min_gap_size, sizeof(__pyx_k__min_gap_size), 0, 0, 1, 1},
{&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
{&__pyx_n_s__namedtuple, __pyx_k__namedtuple, sizeof(__pyx_k__namedtuple), 0, 0, 1, 1},
{&__pyx_n_s__new_e_i, __pyx_k__new_e_i, sizeof(__pyx_k__new_e_i), 0, 0, 1, 1},
{&__pyx_n_s__new_e_j, __pyx_k__new_e_j, sizeof(__pyx_k__new_e_j), 0, 0, 1, 1},
- {&__pyx_n_s__new_rule, __pyx_k__new_rule, sizeof(__pyx_k__new_rule), 0, 0, 1, 1},
+ {&__pyx_n_s__new_min_bound, __pyx_k__new_min_bound, sizeof(__pyx_k__new_min_bound), 0, 0, 1, 1},
{&__pyx_n_s__next_states, __pyx_k__next_states, sizeof(__pyx_k__next_states), 0, 0, 1, 1},
{&__pyx_n_s__nt, __pyx_k__nt, sizeof(__pyx_k__nt), 0, 0, 1, 1},
+ {&__pyx_n_s__nt_collision, __pyx_k__nt_collision, sizeof(__pyx_k__nt_collision), 0, 0, 1, 1},
{&__pyx_n_s__nt_open, __pyx_k__nt_open, sizeof(__pyx_k__nt_open), 0, 0, 1, 1},
{&__pyx_n_s__num_subpatterns, __pyx_k__num_subpatterns, sizeof(__pyx_k__num_subpatterns), 0, 0, 1, 1},
{&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1},
@@ -77057,7 +76713,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__resource, __pyx_k__resource, sizeof(__pyx_k__resource), 0, 0, 1, 1},
{&__pyx_n_s__ru_stime, __pyx_k__ru_stime, sizeof(__pyx_k__ru_stime), 0, 0, 1, 1},
{&__pyx_n_s__ru_utime, __pyx_k__ru_utime, sizeof(__pyx_k__ru_utime), 0, 0, 1, 1},
- {&__pyx_n_s__rule, __pyx_k__rule, sizeof(__pyx_k__rule), 0, 0, 1, 1},
{&__pyx_n_s__sa, __pyx_k__sa, sizeof(__pyx_k__sa), 0, 0, 1, 1},
{&__pyx_n_s__sa_high, __pyx_k__sa_high, sizeof(__pyx_k__sa_high), 0, 0, 1, 1},
{&__pyx_n_s__sa_low, __pyx_k__sa_low, sizeof(__pyx_k__sa_low), 0, 0, 1, 1},
@@ -77076,7 +76731,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 0, 0, 1, 1},
{&__pyx_n_s__source, __pyx_k__source, sizeof(__pyx_k__source), 0, 0, 1, 1},
{&__pyx_n_s__span_check, __pyx_k__span_check, sizeof(__pyx_k__span_check), 0, 0, 1, 1},
- {&__pyx_n_s__span_flip, __pyx_k__span_flip, sizeof(__pyx_k__span_flip), 0, 0, 1, 1},
+ {&__pyx_n_s__span_dec, __pyx_k__span_dec, sizeof(__pyx_k__span_dec), 0, 0, 1, 1},
+ {&__pyx_n_s__span_inc, __pyx_k__span_inc, sizeof(__pyx_k__span_inc), 0, 0, 1, 1},
{&__pyx_n_s__spanlen, __pyx_k__spanlen, sizeof(__pyx_k__spanlen), 0, 0, 1, 1},
{&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
{&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
@@ -77883,14 +77539,14 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_121));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_122));
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1850
- * # Extract all possible hierarchical phrases starting at a source index
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":1861
* # f_ i and j are current, e_ i and j are previous
- * def extract(f_i, f_j, e_i, e_j, wc, links, nt, nt_open): # <<<<<<<<<<<<<<
+ * # We care _considering_ f_j, so it is not yet in counts
+ * def extract(f_i, f_j, e_i, e_j, min_bound, wc, links, nt, nt_open): # <<<<<<<<<<<<<<
* # Phrase extraction limits
- * if wc + len(nt) > self.max_length or (f_j + 1) > f_len or \
+ * if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size:
*/
- __pyx_k_tuple_134 = PyTuple_New(17); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_134 = PyTuple_New(19); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_134);
__Pyx_INCREF(((PyObject *)__pyx_n_s__f_i));
PyTuple_SET_ITEM(__pyx_k_tuple_134, 0, ((PyObject *)__pyx_n_s__f_i));
@@ -77904,172 +77560,178 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_INCREF(((PyObject *)__pyx_n_s__e_j));
PyTuple_SET_ITEM(__pyx_k_tuple_134, 3, ((PyObject *)__pyx_n_s__e_j));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__e_j));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__min_bound));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 4, ((PyObject *)__pyx_n_s__min_bound));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min_bound));
__Pyx_INCREF(((PyObject *)__pyx_n_s__wc));
- PyTuple_SET_ITEM(__pyx_k_tuple_134, 4, ((PyObject *)__pyx_n_s__wc));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 5, ((PyObject *)__pyx_n_s__wc));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__wc));
__Pyx_INCREF(((PyObject *)__pyx_n_s__links));
- PyTuple_SET_ITEM(__pyx_k_tuple_134, 5, ((PyObject *)__pyx_n_s__links));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 6, ((PyObject *)__pyx_n_s__links));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__links));
__Pyx_INCREF(((PyObject *)__pyx_n_s__nt));
- PyTuple_SET_ITEM(__pyx_k_tuple_134, 6, ((PyObject *)__pyx_n_s__nt));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 7, ((PyObject *)__pyx_n_s__nt));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__nt));
__Pyx_INCREF(((PyObject *)__pyx_n_s__nt_open));
- PyTuple_SET_ITEM(__pyx_k_tuple_134, 7, ((PyObject *)__pyx_n_s__nt_open));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 8, ((PyObject *)__pyx_n_s__nt_open));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__nt_open));
__Pyx_INCREF(((PyObject *)__pyx_n_s__link_i));
- PyTuple_SET_ITEM(__pyx_k_tuple_134, 8, ((PyObject *)__pyx_n_s__link_i));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 9, ((PyObject *)__pyx_n_s__link_i));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__link_i));
__Pyx_INCREF(((PyObject *)__pyx_n_s__link_j));
- PyTuple_SET_ITEM(__pyx_k_tuple_134, 9, ((PyObject *)__pyx_n_s__link_j));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 10, ((PyObject *)__pyx_n_s__link_j));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__link_j));
__Pyx_INCREF(((PyObject *)__pyx_n_s__new_e_i));
- PyTuple_SET_ITEM(__pyx_k_tuple_134, 10, ((PyObject *)__pyx_n_s__new_e_i));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 11, ((PyObject *)__pyx_n_s__new_e_i));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__new_e_i));
__Pyx_INCREF(((PyObject *)__pyx_n_s__new_e_j));
- PyTuple_SET_ITEM(__pyx_k_tuple_134, 11, ((PyObject *)__pyx_n_s__new_e_j));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 12, ((PyObject *)__pyx_n_s__new_e_j));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__new_e_j));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__old_last_nt));
- PyTuple_SET_ITEM(__pyx_k_tuple_134, 12, ((PyObject *)__pyx_n_s__old_last_nt));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__old_last_nt));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__rule));
- PyTuple_SET_ITEM(__pyx_k_tuple_134, 13, ((PyObject *)__pyx_n_s__rule));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rule));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__collision));
- PyTuple_SET_ITEM(__pyx_k_tuple_134, 14, ((PyObject *)__pyx_n_s__collision));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__collision));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__new_min_bound));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 13, ((PyObject *)__pyx_n_s__new_min_bound));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new_min_bound));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 14, ((PyObject *)__pyx_n_s__i));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__nt_collision));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 15, ((PyObject *)__pyx_n_s__nt_collision));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nt_collision));
__Pyx_INCREF(((PyObject *)__pyx_n_s__link));
- PyTuple_SET_ITEM(__pyx_k_tuple_134, 15, ((PyObject *)__pyx_n_s__link));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 16, ((PyObject *)__pyx_n_s__link));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__link));
__Pyx_INCREF(((PyObject *)__pyx_n_s__plus_links));
- PyTuple_SET_ITEM(__pyx_k_tuple_134, 16, ((PyObject *)__pyx_n_s__plus_links));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 17, ((PyObject *)__pyx_n_s__plus_links));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__plus_links));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__old_last_nt));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 18, ((PyObject *)__pyx_n_s__old_last_nt));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__old_last_nt));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_134));
- __pyx_k_codeobj_135 = (PyObject*)__Pyx_PyCode_New(8, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_134, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_136, __pyx_n_s__extract, 1850, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_135)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_codeobj_135 = (PyObject*)__Pyx_PyCode_New(9, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_134, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_136, __pyx_n_s__extract, 1861, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_135)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2098
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2063
* # Debugging
* def dump_online_stats(self):
* logger.info('------------------------------') # <<<<<<<<<<<<<<
* logger.info(' Online Stats ')
* logger.info('------------------------------')
*/
- __pyx_k_tuple_140 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_140)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_140 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_140)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_140);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_139));
PyTuple_SET_ITEM(__pyx_k_tuple_140, 0, ((PyObject *)__pyx_kp_s_139));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_139));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_140));
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2099
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2064
* def dump_online_stats(self):
* logger.info('------------------------------')
* logger.info(' Online Stats ') # <<<<<<<<<<<<<<
* logger.info('------------------------------')
- * logger.info('F')
+ * logger.info('f')
*/
- __pyx_k_tuple_142 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_142)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_142 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_142)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_142);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_141));
PyTuple_SET_ITEM(__pyx_k_tuple_142, 0, ((PyObject *)__pyx_kp_s_141));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_141));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_142));
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2100
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2065
* logger.info('------------------------------')
* logger.info(' Online Stats ')
* logger.info('------------------------------') # <<<<<<<<<<<<<<
- * logger.info('F')
- * for ph in self.phrases_f:
+ * logger.info('f')
+ * for w in self.bilex_f:
*/
- __pyx_k_tuple_143 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_143)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_143 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_143)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_143);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_139));
PyTuple_SET_ITEM(__pyx_k_tuple_143, 0, ((PyObject *)__pyx_kp_s_139));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_139));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_143));
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2101
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2066
* logger.info(' Online Stats ')
* logger.info('------------------------------')
- * logger.info('F') # <<<<<<<<<<<<<<
- * for ph in self.phrases_f:
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph]))
- */
- __pyx_k_tuple_144 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_144)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_144);
- __Pyx_INCREF(((PyObject *)__pyx_n_s__F));
- PyTuple_SET_ITEM(__pyx_k_tuple_144, 0, ((PyObject *)__pyx_n_s__F));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__F));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_144));
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2104
- * for ph in self.phrases_f:
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph]))
- * logger.info('E') # <<<<<<<<<<<<<<
- * for ph in self.phrases_e:
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph]))
- */
- __pyx_k_tuple_145 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_145)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_145);
- __Pyx_INCREF(((PyObject *)__pyx_n_s__E));
- PyTuple_SET_ITEM(__pyx_k_tuple_145, 0, ((PyObject *)__pyx_n_s__E));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__E));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_145));
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2107
- * for ph in self.phrases_e:
- * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph]))
- * logger.info('FE') # <<<<<<<<<<<<<<
- * for ph in self.phrases_fe:
- * for ph2 in self.phrases_fe[ph]:
- */
- __pyx_k_tuple_146 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_146)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_146);
- __Pyx_INCREF(((PyObject *)__pyx_n_s__FE));
- PyTuple_SET_ITEM(__pyx_k_tuple_146, 0, ((PyObject *)__pyx_n_s__FE));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FE));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_146));
-
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2111
- * for ph2 in self.phrases_fe[ph]:
- * logger.info(str(ph) + ' ||| ' + str(ph2) + ' ||| ' + str(self.phrases_fe[ph][ph2]))
* logger.info('f') # <<<<<<<<<<<<<<
* for w in self.bilex_f:
* logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w]))
*/
- __pyx_k_tuple_147 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_147)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_147);
+ __pyx_k_tuple_144 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_144)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_144);
__Pyx_INCREF(((PyObject *)__pyx_n_s__f));
- PyTuple_SET_ITEM(__pyx_k_tuple_147, 0, ((PyObject *)__pyx_n_s__f));
+ PyTuple_SET_ITEM(__pyx_k_tuple_144, 0, ((PyObject *)__pyx_n_s__f));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__f));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_147));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_144));
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2114
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2069
* for w in self.bilex_f:
* logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w]))
* logger.info('e') # <<<<<<<<<<<<<<
* for w in self.bilex_e:
* logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w]))
*/
- __pyx_k_tuple_149 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_149)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_149);
+ __pyx_k_tuple_146 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_146)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_146);
__Pyx_INCREF(((PyObject *)__pyx_n_s__e));
- PyTuple_SET_ITEM(__pyx_k_tuple_149, 0, ((PyObject *)__pyx_n_s__e));
+ PyTuple_SET_ITEM(__pyx_k_tuple_146, 0, ((PyObject *)__pyx_n_s__e));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__e));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_149));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_146));
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2117
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2072
* for w in self.bilex_e:
* logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w]))
* logger.info('fe') # <<<<<<<<<<<<<<
* for w in self.bilex_fe:
* for w2 in self.bilex_fe[w]:
*/
- __pyx_k_tuple_150 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_150)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_150);
+ __pyx_k_tuple_147 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_147)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_147);
__Pyx_INCREF(((PyObject *)__pyx_n_s__fe));
- PyTuple_SET_ITEM(__pyx_k_tuple_150, 0, ((PyObject *)__pyx_n_s__fe));
+ PyTuple_SET_ITEM(__pyx_k_tuple_147, 0, ((PyObject *)__pyx_n_s__fe));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__fe));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_147));
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2076
+ * for w2 in self.bilex_fe[w]:
+ * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2]))
+ * logger.info('F') # <<<<<<<<<<<<<<
+ * for ph in self.phrases_f:
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph]))
+ */
+ __pyx_k_tuple_148 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_148)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_148);
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__F));
+ PyTuple_SET_ITEM(__pyx_k_tuple_148, 0, ((PyObject *)__pyx_n_s__F));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__F));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_148));
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2079
+ * for ph in self.phrases_f:
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph]))
+ * logger.info('E') # <<<<<<<<<<<<<<
+ * for ph in self.phrases_e:
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph]))
+ */
+ __pyx_k_tuple_149 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_149)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_149);
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__E));
+ PyTuple_SET_ITEM(__pyx_k_tuple_149, 0, ((PyObject *)__pyx_n_s__E));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__E));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_149));
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2082
+ * for ph in self.phrases_e:
+ * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph]))
+ * logger.info('FE') # <<<<<<<<<<<<<<
+ * for ph in self.phrases_fe:
+ * for ph2 in self.phrases_fe[ph]:
+ */
+ __pyx_k_tuple_150 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_150)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_150);
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__FE));
+ PyTuple_SET_ITEM(__pyx_k_tuple_150, 0, ((PyObject *)__pyx_n_s__FE));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FE));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_150));
/* "_sa.pyx":9
@@ -78214,14 +77876,14 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_166));
__pyx_k_codeobj_167 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_166, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_159, __pyx_n_s__decode_words, 121, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_167)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2124
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2088
+ *
* # Spans are _inclusive_ on both ends [i, j]
- * # Could be more efficient but probably not a bottleneck
* def span_check(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_k_tuple_169 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_169)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_169 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_169)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_169);
__Pyx_INCREF(((PyObject *)__pyx_n_s__vec));
PyTuple_SET_ITEM(__pyx_k_tuple_169, 0, ((PyObject *)__pyx_n_s__vec));
@@ -78236,16 +77898,16 @@ static int __Pyx_InitCachedConstants(void) {
PyTuple_SET_ITEM(__pyx_k_tuple_169, 3, ((PyObject *)__pyx_n_s__k));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_169));
- __pyx_k_codeobj_170 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_169, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_136, __pyx_n_s__span_check, 2124, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_170)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_codeobj_170 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_169, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_136, __pyx_n_s__span_check, 2088, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_170)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2132
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2096
* return True
*
- * def span_flip(vec, i, j): # <<<<<<<<<<<<<<
+ * def span_inc(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_k_tuple_171 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_171)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_171 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_171)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_171);
__Pyx_INCREF(((PyObject *)__pyx_n_s__vec));
PyTuple_SET_ITEM(__pyx_k_tuple_171, 0, ((PyObject *)__pyx_n_s__vec));
@@ -78260,7 +77922,31 @@ static int __Pyx_InitCachedConstants(void) {
PyTuple_SET_ITEM(__pyx_k_tuple_171, 3, ((PyObject *)__pyx_n_s__k));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_171));
- __pyx_k_codeobj_172 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_171, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_136, __pyx_n_s__span_flip, 2132, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_172)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_codeobj_172 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_171, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_136, __pyx_n_s__span_inc, 2096, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_172)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2102
+ * k += 1
+ *
+ * def span_dec(vec, i, j): # <<<<<<<<<<<<<<
+ * k = i
+ * while k <= j:
+ */
+ __pyx_k_tuple_173 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_173)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_173);
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__vec));
+ PyTuple_SET_ITEM(__pyx_k_tuple_173, 0, ((PyObject *)__pyx_n_s__vec));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vec));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
+ PyTuple_SET_ITEM(__pyx_k_tuple_173, 1, ((PyObject *)__pyx_n_s__i));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
+ PyTuple_SET_ITEM(__pyx_k_tuple_173, 2, ((PyObject *)__pyx_n_s__j));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
+ PyTuple_SET_ITEM(__pyx_k_tuple_173, 3, ((PyObject *)__pyx_n_s__k));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_173));
+ __pyx_k_codeobj_174 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_173, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_136, __pyx_n_s__span_dec, 2102, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_174)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
@@ -78568,13 +78254,13 @@ PyMODINIT_FUNC PyInit__sa(void)
__pyx_ptype_3_sa___pyx_scope_struct_19_input = &__pyx_type_3_sa___pyx_scope_struct_19_input;
if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_20_add_instance) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_3_sa___pyx_scope_struct_20_add_instance = &__pyx_type_3_sa___pyx_scope_struct_20_add_instance;
- if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_21_new_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_3_sa___pyx_scope_struct_21_new_rule = &__pyx_type_3_sa___pyx_scope_struct_21_new_rule;
- if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_22_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_21_form_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_3_sa___pyx_scope_struct_21_form_rule = &__pyx_type_3_sa___pyx_scope_struct_21_form_rule;
+ if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_22_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_3_sa___pyx_scope_struct_22_genexpr = &__pyx_type_3_sa___pyx_scope_struct_22_genexpr;
- if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_23_fmt_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_23_fmt_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_3_sa___pyx_scope_struct_23_fmt_rule = &__pyx_type_3_sa___pyx_scope_struct_23_fmt_rule;
- if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_24_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_24_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_3_sa___pyx_scope_struct_24_genexpr = &__pyx_type_3_sa___pyx_scope_struct_24_genexpr;
if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_25___iter__) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_3_sa___pyx_scope_struct_25___iter__ = &__pyx_type_3_sa___pyx_scope_struct_25___iter__;
@@ -78972,28 +78658,40 @@ PyMODINIT_FUNC PyInit__sa(void)
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2124
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2088
+ *
* # Spans are _inclusive_ on both ends [i, j]
- * # Could be more efficient but probably not a bottleneck
* def span_check(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_13span_check, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_13span_check, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__span_check, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__span_check, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2132
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2096
* return True
*
- * def span_flip(vec, i, j): # <<<<<<<<<<<<<<
+ * def span_inc(vec, i, j): # <<<<<<<<<<<<<<
+ * k = i
+ * while k <= j:
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_15span_inc, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__span_inc, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "/home/m/workspace/cdec/python/src/sa/rulefactory.pxi":2102
+ * k += 1
+ *
+ * def span_dec(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_15span_flip, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_17span_dec, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__span_flip, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__span_dec, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "/home/m/workspace/cdec/python/src/sa/features.pxi":1