From 9cf584746a55fd724de6af39f2fbe7bff1b79643 Mon Sep 17 00:00:00 2001
From: Michael Denkowski <mdenkows@cs.cmu.edu>
Date: Mon, 24 Feb 2014 23:18:47 -0800
Subject: CountExceptLM and CountExceptLex features for online grammar
 extraction.

---
 python/cdec/sa/_sa.cpp      | 2329 +++++++++++++++++++++----------------------
 python/cdec/sa/bilex.pxi    |    8 +
 python/cdec/sa/extract.py   |    8 +-
 python/cdec/sa/extractor.py |    9 +-
 python/cdec/sa/features.py  |   16 +
 5 files changed, 1171 insertions(+), 1199 deletions(-)

(limited to 'python')

diff --git a/python/cdec/sa/_sa.cpp b/python/cdec/sa/_sa.cpp
index a9f7855e..a19c9c64 100644
--- a/python/cdec/sa/_sa.cpp
+++ b/python/cdec/sa/_sa.cpp
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.19.1 on Tue Sep 24 13:39:51 2013 */
+/* Generated by Cython 0.19.2 on Mon Feb 24 22:41:13 2014 */
 
 #define PY_SSIZE_T_CLEAN
 #ifndef CYTHON_USE_PYLONG_INTERNALS
@@ -264,7 +264,7 @@
 #ifndef CYTHON_RESTRICT
   #if defined(__GNUC__)
     #define CYTHON_RESTRICT __restrict__
-  #elif defined(_MSC_VER)
+  #elif defined(_MSC_VER) && _MSC_VER >= 1400
     #define CYTHON_RESTRICT __restrict
   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
     #define CYTHON_RESTRICT restrict
@@ -1989,6 +1989,14 @@ static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *__pyx_vtabptr_4cdec_2sa
   #define __Pyx_XGOTREF(r)
   #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
+#define __Pyx_XDECREF_SET(r, v) do {                            \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_XDECREF(tmp);                              \
+    } while (0)
+#define __Pyx_DECREF_SET(r, v) do {                             \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_DECREF(tmp);                               \
+    } while (0)
 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
@@ -2664,12 +2672,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj
 static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_from_text, PyObject *__pyx_v_from_data, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_earray, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_alignment); /* proto */
 static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */
 static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */
-static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword); /* proto */
-static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword); /* proto */
-static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */
-static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */
-static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col); /* proto */
-static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6contains_e_word(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword); /* proto */
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8contains_f_word(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword); /* proto */
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10get_e_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword); /* proto */
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12get_f_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword); /* proto */
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col); /* proto */
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_20write_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */
 static PyObject *__pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *__pyx_v_self); /* proto */
 static int __pyx_pf_4cdec_2sa_3_sa_6BitSet___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */
 static void __pyx_pf_4cdec_2sa_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */
@@ -4229,8 +4239,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_ob
     __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_v_j);
-    __pyx_v_j = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_j, __pyx_t_3);
     __pyx_t_3 = 0;
     goto __pyx_L3;
   }
@@ -5109,8 +5118,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
  */
       __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_ret, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_v_ret);
-      __pyx_v_ret = __pyx_t_4;
+      __Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_4);
       __pyx_t_4 = 0;
       goto __pyx_L5;
     }
@@ -5136,8 +5144,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
     __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_ret, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_v_ret);
-    __pyx_v_ret = __pyx_t_5;
+    __Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_5);
     __pyx_t_5 = 0;
   }
 
@@ -5150,8 +5157,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
  */
   __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_ret, ((PyObject *)__pyx_kp_s_5)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_v_ret);
-  __pyx_v_ret = __pyx_t_5;
+  __Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_5);
   __pyx_t_5 = 0;
 
   /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":28
@@ -5163,8 +5169,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
  */
   __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_ret, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_v_ret);
-  __pyx_v_ret = __pyx_t_5;
+  __Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_5);
   __pyx_t_5 = 0;
 
   /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":29
@@ -5187,8 +5192,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
   __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_ret, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_v_ret);
-  __pyx_v_ret = __pyx_t_4;
+  __Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_4);
   __pyx_t_4 = 0;
 
   /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":30
@@ -5499,8 +5503,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
  */
       __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_bottom, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_v_bottom);
-      __pyx_v_bottom = __pyx_t_2;
+      __Pyx_DECREF_SET(__pyx_v_bottom, __pyx_t_2);
       __pyx_t_2 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":47
@@ -5597,8 +5600,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
  */
       __pyx_t_4 = PyNumber_InPlaceSubtract(__pyx_v_top, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_v_top);
-      __pyx_v_top = __pyx_t_4;
+      __Pyx_DECREF_SET(__pyx_v_top, __pyx_t_4);
       __pyx_t_4 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":55
@@ -6517,8 +6519,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
       __pyx_t_9 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_9));
       __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_v_result));
-      __pyx_v_result = ((PyObject*)__pyx_t_9);
+      __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_9));
       __pyx_t_9 = 0;
     }
 
@@ -8032,8 +8033,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_o
   for (__pyx_t_4 = __pyx_v_start; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
     __pyx_t_1 = PyInt_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_1;
+    __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_1);
     __pyx_t_1 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":44
@@ -8060,8 +8060,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_o
  */
   __pyx_t_1 = PyInt_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_v_i);
-  __pyx_v_i = __pyx_t_1;
+  __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_1);
   __pyx_t_1 = 0;
 
   /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":45
@@ -8461,8 +8460,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(struct __pyx_ob
               }
               __Pyx_GOTREF(__pyx_t_1);
             }
-            __Pyx_XDECREF(__pyx_v_w_id);
-            __pyx_v_w_id = __pyx_t_1;
+            __Pyx_XDECREF_SET(__pyx_v_w_id, __pyx_t_1);
             __pyx_t_1 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":63
@@ -9034,9 +9032,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_9DataArray_11read_bitext_2generator6(__
       __Pyx_GOTREF(__pyx_t_4);
     }
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_line);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_line);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_line, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_cur_scope->__pyx_v_line = __pyx_t_4;
     __pyx_t_4 = 0;
     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
@@ -9390,12 +9387,10 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_line);
-    __pyx_v_line = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_5);
     __pyx_t_5 = 0;
     __Pyx_INCREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_line_num);
-    __pyx_v_line_num = __pyx_t_1;
+    __Pyx_XDECREF_SET(__pyx_v_line_num, __pyx_t_1);
     __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_1);
@@ -9463,8 +9458,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
         }
         __Pyx_GOTREF(__pyx_t_5);
       }
-      __Pyx_XDECREF(__pyx_v_word);
-      __pyx_v_word = __pyx_t_5;
+      __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_5);
       __pyx_t_5 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":82
@@ -9993,8 +9987,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cde
       }
       __Pyx_GOTREF(__pyx_t_1);
     }
-    __Pyx_XDECREF(__pyx_v_word);
-    __pyx_v_word = __pyx_t_1;
+    __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_1);
     __pyx_t_1 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":131
@@ -10185,8 +10178,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
       }
       __Pyx_GOTREF(__pyx_t_4);
     }
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":143
@@ -10268,8 +10260,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
       }
       __Pyx_GOTREF(__pyx_t_1);
     }
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_1;
+    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
     __pyx_t_1 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":146
@@ -10351,8 +10342,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
     __pyx_t_5 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":149
@@ -10434,8 +10424,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
       }
       __Pyx_GOTREF(__pyx_t_6);
     }
-    __Pyx_XDECREF(__pyx_v_word);
-    __pyx_v_word = __pyx_t_6;
+    __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_6);
     __pyx_t_6 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":152
@@ -11902,8 +11891,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
               }
               __Pyx_GOTREF(__pyx_t_2);
             }
-            __Pyx_XDECREF(__pyx_v_line);
-            __pyx_v_line = __pyx_t_2;
+            __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_2);
             __pyx_t_2 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":58
@@ -11936,8 +11924,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
             __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_2);
             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-            __Pyx_XDECREF(__pyx_v_pairs);
-            __pyx_v_pairs = __pyx_t_2;
+            __Pyx_XDECREF_SET(__pyx_v_pairs, __pyx_t_2);
             __pyx_t_2 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":60
@@ -11981,8 +11968,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
                 }
                 __Pyx_GOTREF(__pyx_t_3);
               }
-              __Pyx_XDECREF(__pyx_v_pair);
-              __pyx_v_pair = __pyx_t_3;
+              __Pyx_XDECREF_SET(__pyx_v_pair, __pyx_t_3);
               __pyx_t_3 = 0;
 
               /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":61
@@ -12059,11 +12045,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
                 {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                 __pyx_L21_unpacking_done:;
               }
-              __Pyx_XDECREF(__pyx_v_i);
-              __pyx_v_i = __pyx_t_3;
+              __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
               __pyx_t_3 = 0;
-              __Pyx_XDECREF(__pyx_v_j);
-              __pyx_v_j = __pyx_t_13;
+              __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_13);
               __pyx_t_13 = 0;
 
               /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":62
@@ -12451,12 +12435,10 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_ob
               }
               __Pyx_GOTREF(__pyx_t_2);
             }
-            __Pyx_XDECREF(__pyx_v_link);
-            __pyx_v_link = __pyx_t_2;
+            __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_2);
             __pyx_t_2 = 0;
             __Pyx_INCREF(__pyx_t_4);
-            __Pyx_XDECREF(__pyx_v_i);
-            __pyx_v_i = __pyx_t_4;
+            __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
             __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_2);
             __Pyx_DECREF(__pyx_t_4);
@@ -12502,8 +12484,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_ob
  */
               __pyx_t_2 = PyNumber_Add(__pyx_v_sent_num, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_GOTREF(__pyx_t_2);
-              __Pyx_DECREF(__pyx_v_sent_num);
-              __pyx_v_sent_num = __pyx_t_2;
+              __Pyx_DECREF_SET(__pyx_v_sent_num, __pyx_t_2);
               __pyx_t_2 = 0;
             }
 
@@ -12888,8 +12869,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __py
               }
               __Pyx_GOTREF(__pyx_t_1);
             }
-            __Pyx_XDECREF(__pyx_v_link);
-            __pyx_v_link = __pyx_t_1;
+            __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_1);
             __pyx_t_1 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":92
@@ -12971,8 +12951,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __py
               }
               __Pyx_GOTREF(__pyx_t_4);
             }
-            __Pyx_XDECREF(__pyx_v_i);
-            __pyx_v_i = __pyx_t_4;
+            __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
             __pyx_t_4 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":95
@@ -14014,8 +13993,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
       }
       __Pyx_GOTREF(__pyx_t_4);
     }
-    __Pyx_XDECREF(__pyx_v_word);
-    __pyx_v_word = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":81
@@ -14083,12 +14061,10 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_word);
-    __pyx_v_word = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_5);
     __pyx_t_5 = 0;
     __Pyx_INCREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_id);
-    __pyx_v_id = __pyx_t_1;
+    __Pyx_XDECREF_SET(__pyx_v_id, __pyx_t_1);
     __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_1);
@@ -14148,8 +14124,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
       }
       __Pyx_GOTREF(__pyx_t_4);
     }
-    __Pyx_XDECREF(__pyx_v_word);
-    __pyx_v_word = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":87
@@ -14217,12 +14192,10 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_word);
-    __pyx_v_word = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_5);
     __pyx_t_5 = 0;
     __Pyx_INCREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_id);
-    __pyx_v_id = __pyx_t_1;
+    __Pyx_XDECREF_SET(__pyx_v_id, __pyx_t_1);
     __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_1);
@@ -15544,8 +15517,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED stru
       }
       __Pyx_GOTREF(__pyx_t_4);
     }
-    __Pyx_XDECREF(__pyx_v_word);
-    __pyx_v_word = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":221
@@ -15863,17 +15835,129 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4c
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword); /*proto*/
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword) {
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_7contains_e_word(PyObject *__pyx_v_self, PyObject *__pyx_v_eword); /*proto*/
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_7contains_e_word(PyObject *__pyx_v_self, PyObject *__pyx_v_eword) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("get_e_id (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_eword));
+  __Pyx_RefNannySetupContext("contains_e_word (wrapper)", 0);
+  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_6contains_e_word(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_eword));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
 /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":252
+ * 
+ * 
+ *     def contains_e_word(self, eword):             # <<<<<<<<<<<<<<
+ *         return (eword in self.eword2id)
+ * 
+ */
+
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6contains_e_word(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("contains_e_word", 0);
+
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":253
+ * 
+ *     def contains_e_word(self, eword):
+ *         return (eword in self.eword2id)             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_eword, __pyx_v_self->eword2id, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __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_2);
+  __Pyx_AddTraceback("cdec.sa._sa.BiLex.contains_e_word", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_9contains_f_word(PyObject *__pyx_v_self, PyObject *__pyx_v_fword); /*proto*/
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_9contains_f_word(PyObject *__pyx_v_self, PyObject *__pyx_v_fword) {
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("contains_f_word (wrapper)", 0);
+  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_8contains_f_word(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_fword));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":256
+ * 
+ * 
+ *     def contains_f_word(self, fword):             # <<<<<<<<<<<<<<
+ *         return (fword in self.fword2id)
+ * 
+ */
+
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8contains_f_word(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("contains_f_word", 0);
+
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":257
+ * 
+ *     def contains_f_word(self, fword):
+ *         return (fword in self.fword2id)             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_fword, __pyx_v_self->fword2id, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __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_2);
+  __Pyx_AddTraceback("cdec.sa._sa.BiLex.contains_f_word", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_11get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword); /*proto*/
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_11get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword) {
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("get_e_id (wrapper)", 0);
+  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_10get_e_id(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_eword));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":260
  * 
  * 
  *     def get_e_id(self, eword):             # <<<<<<<<<<<<<<
@@ -15881,7 +15965,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self
  *             e_id = len(self.id2eword)
  */
 
-static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword) {
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10get_e_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword) {
   PyObject *__pyx_v_e_id = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -15894,18 +15978,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(struct __pyx_obj_4cdec
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("get_e_id", 0);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":253
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":261
  * 
  *     def get_e_id(self, eword):
  *         if eword not in self.eword2id:             # <<<<<<<<<<<<<<
  *             e_id = len(self.id2eword)
  *             self.id2eword.append(eword)
  */
-  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_eword, __pyx_v_self->eword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_eword, __pyx_v_self->eword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":254
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":262
  *     def get_e_id(self, eword):
  *         if eword not in self.eword2id:
  *             e_id = len(self.id2eword)             # <<<<<<<<<<<<<<
@@ -15914,37 +15998,37 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(struct __pyx_obj_4cdec
  */
     __pyx_t_3 = __pyx_v_self->id2eword;
     __Pyx_INCREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 254; __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[5]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_v_e_id = __pyx_t_3;
     __pyx_t_3 = 0;
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":255
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":263
  *         if eword not in self.eword2id:
  *             e_id = len(self.id2eword)
  *             self.id2eword.append(eword)             # <<<<<<<<<<<<<<
  *             self.eword2id[eword] = e_id
  *         return self.eword2id[eword]
  */
-    __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_self->id2eword, __pyx_v_eword); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_self->id2eword, __pyx_v_eword); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":256
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":264
  *             e_id = len(self.id2eword)
  *             self.id2eword.append(eword)
  *             self.eword2id[eword] = e_id             # <<<<<<<<<<<<<<
  *         return self.eword2id[eword]
  * 
  */
-    if (PyObject_SetItem(__pyx_v_self->eword2id, __pyx_v_eword, __pyx_v_e_id) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyObject_SetItem(__pyx_v_self->eword2id, __pyx_v_eword, __pyx_v_e_id) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":257
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":265
  *             self.id2eword.append(eword)
  *             self.eword2id[eword] = e_id
  *         return self.eword2id[eword]             # <<<<<<<<<<<<<<
@@ -15952,7 +16036,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(struct __pyx_obj_4cdec
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = PyObject_GetItem(__pyx_v_self->eword2id, __pyx_v_eword); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetItem(__pyx_v_self->eword2id, __pyx_v_eword); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_r = __pyx_t_3;
   __pyx_t_3 = 0;
@@ -15972,17 +16056,17 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(struct __pyx_obj_4cdec
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword); /*proto*/
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword) {
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_13get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword); /*proto*/
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_13get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("get_f_id (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_fword));
+  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_12get_f_id(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_fword));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":260
+/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":268
  * 
  * 
  *     def get_f_id(self, fword):             # <<<<<<<<<<<<<<
@@ -15990,7 +16074,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self
  *             f_id = len(self.id2fword)
  */
 
-static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword) {
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12get_f_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword) {
   PyObject *__pyx_v_f_id = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -16003,18 +16087,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(struct __pyx_obj_4cdec
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("get_f_id", 0);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":261
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":269
  * 
  *     def get_f_id(self, fword):
  *         if fword not in self.fword2id:             # <<<<<<<<<<<<<<
  *             f_id = len(self.id2fword)
  *             self.id2fword.append(fword)
  */
-  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_fword, __pyx_v_self->fword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_fword, __pyx_v_self->fword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":262
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":270
  *     def get_f_id(self, fword):
  *         if fword not in self.fword2id:
  *             f_id = len(self.id2fword)             # <<<<<<<<<<<<<<
@@ -16023,37 +16107,37 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(struct __pyx_obj_4cdec
  */
     __pyx_t_3 = __pyx_v_self->id2fword;
     __Pyx_INCREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 262; __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[5]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_v_f_id = __pyx_t_3;
     __pyx_t_3 = 0;
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":263
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":271
  *         if fword not in self.fword2id:
  *             f_id = len(self.id2fword)
  *             self.id2fword.append(fword)             # <<<<<<<<<<<<<<
  *             self.fword2id[fword] = f_id
  *         return self.fword2id[fword]
  */
-    __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_self->id2fword, __pyx_v_fword); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_self->id2fword, __pyx_v_fword); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":264
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":272
  *             f_id = len(self.id2fword)
  *             self.id2fword.append(fword)
  *             self.fword2id[fword] = f_id             # <<<<<<<<<<<<<<
  *         return self.fword2id[fword]
  * 
  */
-    if (PyObject_SetItem(__pyx_v_self->fword2id, __pyx_v_fword, __pyx_v_f_id) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyObject_SetItem(__pyx_v_self->fword2id, __pyx_v_fword, __pyx_v_f_id) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":265
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273
  *             self.id2fword.append(fword)
  *             self.fword2id[fword] = f_id
  *         return self.fword2id[fword]             # <<<<<<<<<<<<<<
@@ -16061,7 +16145,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(struct __pyx_obj_4cdec
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = PyObject_GetItem(__pyx_v_self->fword2id, __pyx_v_fword); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetItem(__pyx_v_self->fword2id, __pyx_v_fword); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_r = __pyx_t_3;
   __pyx_t_3 = 0;
@@ -16081,8 +16165,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(struct __pyx_obj_4cdec
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) {
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) {
   char *__pyx_v_filename;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -16091,7 +16175,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text(PyObject *__pyx_v_se
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("read_text (wrapper)", 0);
   assert(__pyx_arg_filename); {
-    __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L3_error:;
@@ -16099,12 +16183,12 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text(PyObject *__pyx_v_se
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename));
+  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":268
+/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":276
  * 
  * 
  *     def read_text(self, char* filename):             # <<<<<<<<<<<<<<
@@ -16112,7 +16196,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text(PyObject *__pyx_v_se
  *         cdef IntList fcount
  */
 
-static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) {
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) {
   PyObject *__pyx_v_i = 0;
   PyObject *__pyx_v_j = 0;
   PyObject *__pyx_v_e_id = 0;
@@ -16159,19 +16243,19 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("read_text", 0);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":272
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":280
  *         cdef IntList fcount
  * 
  *         fcount = IntList()             # <<<<<<<<<<<<<<
  *         with gzip_or_text(filename) as f:
  *             # first loop merely establishes size of array objects
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_v_fcount = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":281
  * 
  *         fcount = IntList()
  *         with gzip_or_text(filename) as f:             # <<<<<<<<<<<<<<
@@ -16179,24 +16263,24 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
  *             for line in f:
  */
   /*with:*/ {
-    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__gzip_or_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__gzip_or_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
     __Pyx_GIVEREF(((PyObject *)__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[5]; __pyx_lineno = 273; __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[5]; __pyx_lineno = 281; __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_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -16211,7 +16295,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
           __pyx_v_f = __pyx_t_1;
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":275
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":283
  *         with gzip_or_text(filename) as f:
  *             # first loop merely establishes size of array objects
  *             for line in f:             # <<<<<<<<<<<<<<
@@ -16222,7 +16306,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
             __pyx_t_1 = __pyx_v_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
             __pyx_t_9 = NULL;
           } else {
-            __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_1);
             __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext;
           }
@@ -16230,42 +16314,41 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
             if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) {
               if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
               #if CYTHON_COMPILING_IN_CPYTHON
-              __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #else
-              __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #endif
             } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) {
               if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
               #if CYTHON_COMPILING_IN_CPYTHON
-              __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #else
-              __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #endif
             } else {
               __pyx_t_2 = __pyx_t_9(__pyx_t_1);
               if (unlikely(!__pyx_t_2)) {
                 if (PyErr_Occurred()) {
                   if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
-                  else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+                  else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                 }
                 break;
               }
               __Pyx_GOTREF(__pyx_t_2);
             }
-            __Pyx_XDECREF(__pyx_v_line);
-            __pyx_v_line = __pyx_t_2;
+            __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_2);
             __pyx_t_2 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":276
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":284
  *             # first loop merely establishes size of array objects
  *             for line in f:
  *                 (fword, eword, score1, score2) = line.split()             # <<<<<<<<<<<<<<
  *                 f_id = self.get_f_id(fword)
  *                 e_id = self.get_e_id(eword)
  */
-            __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_2);
-            __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_3);
             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
             if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
@@ -16278,7 +16361,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
               if (unlikely(size != 4)) {
                 if (size > 4) __Pyx_RaiseTooManyValuesError(4);
                 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-                {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+                {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               }
               #if CYTHON_COMPILING_IN_CPYTHON
               if (likely(PyTuple_CheckExact(sequence))) {
@@ -16300,7 +16383,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
               Py_ssize_t i;
               PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12};
               for (i=0; i < 4; i++) {
-                PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+                PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                 __Pyx_GOTREF(item);
                 *(temps[i]) = item;
               }
@@ -16310,7 +16393,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
             {
               Py_ssize_t index = -1;
               PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12};
-              __pyx_t_13 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_13 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_GOTREF(__pyx_t_13);
               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
               __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
@@ -16319,7 +16402,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
                 __Pyx_GOTREF(item);
                 *(temps[index]) = item;
               }
-              if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __pyx_t_14 = NULL;
               __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
               goto __pyx_L19_unpacking_done;
@@ -16327,67 +16410,61 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
               __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
               __pyx_t_14 = NULL;
               if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
-              {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __pyx_L19_unpacking_done:;
             }
-            __Pyx_XDECREF(__pyx_v_fword);
-            __pyx_v_fword = __pyx_t_2;
+            __Pyx_XDECREF_SET(__pyx_v_fword, __pyx_t_2);
             __pyx_t_2 = 0;
-            __Pyx_XDECREF(__pyx_v_eword);
-            __pyx_v_eword = __pyx_t_10;
+            __Pyx_XDECREF_SET(__pyx_v_eword, __pyx_t_10);
             __pyx_t_10 = 0;
-            __Pyx_XDECREF(__pyx_v_score1);
-            __pyx_v_score1 = __pyx_t_11;
+            __Pyx_XDECREF_SET(__pyx_v_score1, __pyx_t_11);
             __pyx_t_11 = 0;
-            __Pyx_XDECREF(__pyx_v_score2);
-            __pyx_v_score2 = __pyx_t_12;
+            __Pyx_XDECREF_SET(__pyx_v_score2, __pyx_t_12);
             __pyx_t_12 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":277
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":285
  *             for line in f:
  *                 (fword, eword, score1, score2) = line.split()
  *                 f_id = self.get_f_id(fword)             # <<<<<<<<<<<<<<
  *                 e_id = self.get_e_id(eword)
  *                 while f_id >= len(fcount):
  */
-            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_f_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_f_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_3);
-            __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_12);
             __Pyx_INCREF(__pyx_v_fword);
             PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_fword);
             __Pyx_GIVEREF(__pyx_v_fword);
-            __pyx_t_11 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_11 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_11);
             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
             __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
-            __Pyx_XDECREF(__pyx_v_f_id);
-            __pyx_v_f_id = __pyx_t_11;
+            __Pyx_XDECREF_SET(__pyx_v_f_id, __pyx_t_11);
             __pyx_t_11 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":278
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":286
  *                 (fword, eword, score1, score2) = line.split()
  *                 f_id = self.get_f_id(fword)
  *                 e_id = self.get_e_id(eword)             # <<<<<<<<<<<<<<
  *                 while f_id >= len(fcount):
  *                     fcount.append(0)
  */
-            __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_e_id); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_e_id); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_11);
-            __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_12);
             __Pyx_INCREF(__pyx_v_eword);
             PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_eword);
             __Pyx_GIVEREF(__pyx_v_eword);
-            __pyx_t_3 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_3 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_3);
             __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
             __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
-            __Pyx_XDECREF(__pyx_v_e_id);
-            __pyx_v_e_id = __pyx_t_3;
+            __Pyx_XDECREF_SET(__pyx_v_e_id, __pyx_t_3);
             __pyx_t_3 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":279
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":287
  *                 f_id = self.get_f_id(fword)
  *                 e_id = self.get_e_id(eword)
  *                 while f_id >= len(fcount):             # <<<<<<<<<<<<<<
@@ -16395,41 +16472,41 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
  *                 fcount.arr[f_id] = fcount.arr[f_id] + 1
  */
             while (1) {
-              __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_fcount)); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-              __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_15); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_fcount)); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_15); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_12 = PyObject_RichCompare(__pyx_v_f_id, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_12 = PyObject_RichCompare(__pyx_v_f_id, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
               if (!__pyx_t_16) break;
 
-              /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":280
+              /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":288
  *                 e_id = self.get_e_id(eword)
  *                 while f_id >= len(fcount):
  *                     fcount.append(0)             # <<<<<<<<<<<<<<
  *                 fcount.arr[f_id] = fcount.arr[f_id] + 1
  * 
  */
-              __pyx_t_12 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_fcount), __pyx_int_0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_12 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_fcount), __pyx_int_0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_GOTREF(__pyx_t_12);
               __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
             }
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":281
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":289
  *                 while f_id >= len(fcount):
  *                     fcount.append(0)
  *                 fcount.arr[f_id] = fcount.arr[f_id] + 1             # <<<<<<<<<<<<<<
  * 
  *             # Allocate space for dictionary in arrays
  */
-            __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-            __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             (__pyx_v_fcount->arr[__pyx_t_17]) = ((__pyx_v_fcount->arr[__pyx_t_15]) + 1);
           }
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":284
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":292
  * 
  *             # Allocate space for dictionary in arrays
  *             N = 0             # <<<<<<<<<<<<<<
@@ -16439,33 +16516,33 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
           __Pyx_INCREF(__pyx_int_0);
           __pyx_v_N = __pyx_int_0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":285
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":293
  *             # Allocate space for dictionary in arrays
  *             N = 0
  *             n_f = len(fcount)             # <<<<<<<<<<<<<<
  *             self.f_index = IntList(initial_len=n_f+1)
  *             for i from 0 <= i < n_f:
  */
-          __pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_fcount)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-          __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_fcount)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_1);
           __pyx_v_n_f = __pyx_t_1;
           __pyx_t_1 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":286
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":294
  *             N = 0
  *             n_f = len(fcount)
  *             self.f_index = IntList(initial_len=n_f+1)             # <<<<<<<<<<<<<<
  *             for i from 0 <= i < n_f:
  *                 self.f_index.arr[i] = N
  */
-          __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-          __pyx_t_12 = PyNumber_Add(__pyx_v_n_f, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_12 = PyNumber_Add(__pyx_v_n_f, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_12);
-          if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-          __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_12);
           __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
           __Pyx_GIVEREF(__pyx_t_12);
@@ -16474,96 +16551,93 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
           __pyx_v_self->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12);
           __pyx_t_12 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":287
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":295
  *             n_f = len(fcount)
  *             self.f_index = IntList(initial_len=n_f+1)
  *             for i from 0 <= i < n_f:             # <<<<<<<<<<<<<<
  *                 self.f_index.arr[i] = N
  *                 N = N + fcount.arr[i]
  */
-          __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_n_f); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_n_f); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19++) {
-            __pyx_t_12 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_12 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_12);
-            __Pyx_XDECREF(__pyx_v_i);
-            __pyx_v_i = __pyx_t_12;
+            __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_12);
             __pyx_t_12 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":288
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":296
  *             self.f_index = IntList(initial_len=n_f+1)
  *             for i from 0 <= i < n_f:
  *                 self.f_index.arr[i] = N             # <<<<<<<<<<<<<<
  *                 N = N + fcount.arr[i]
  *                 fcount.arr[i] = 0
  */
-            __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_N); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-            __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_N); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             (__pyx_v_self->f_index->arr[__pyx_t_8]) = __pyx_t_20;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":289
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":297
  *             for i from 0 <= i < n_f:
  *                 self.f_index.arr[i] = N
  *                 N = N + fcount.arr[i]             # <<<<<<<<<<<<<<
  *                 fcount.arr[i] = 0
  *             self.f_index.arr[n_f] = N
  */
-            __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-            __pyx_t_12 = PyInt_FromLong((__pyx_v_fcount->arr[__pyx_t_8])); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_12 = PyInt_FromLong((__pyx_v_fcount->arr[__pyx_t_8])); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_12);
-            __pyx_t_1 = PyNumber_Add(__pyx_v_N, __pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_1 = PyNumber_Add(__pyx_v_N, __pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_1);
             __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-            __Pyx_DECREF(__pyx_v_N);
-            __pyx_v_N = __pyx_t_1;
+            __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
             __pyx_t_1 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":290
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":298
  *                 self.f_index.arr[i] = N
  *                 N = N + fcount.arr[i]
  *                 fcount.arr[i] = 0             # <<<<<<<<<<<<<<
  *             self.f_index.arr[n_f] = N
  *             self.e_index = IntList(initial_len=N)
  */
-            __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             (__pyx_v_fcount->arr[__pyx_t_8]) = 0;
-            __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           }
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":287
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":295
  *             n_f = len(fcount)
  *             self.f_index = IntList(initial_len=n_f+1)
  *             for i from 0 <= i < n_f:             # <<<<<<<<<<<<<<
  *                 self.f_index.arr[i] = N
  *                 N = N + fcount.arr[i]
  */
-          __pyx_t_1 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_1 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_1);
-          __Pyx_XDECREF(__pyx_v_i);
-          __pyx_v_i = __pyx_t_1;
+          __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
           __pyx_t_1 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":291
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":299
  *                 N = N + fcount.arr[i]
  *                 fcount.arr[i] = 0
  *             self.f_index.arr[n_f] = N             # <<<<<<<<<<<<<<
  *             self.e_index = IntList(initial_len=N)
  *             self.col1 = FloatList(initial_len=N)
  */
-          __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_N); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-          __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_n_f); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_N); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_n_f); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           (__pyx_v_self->f_index->arr[__pyx_t_8]) = __pyx_t_20;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":292
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":300
  *                 fcount.arr[i] = 0
  *             self.f_index.arr[n_f] = N
  *             self.e_index = IntList(initial_len=N)             # <<<<<<<<<<<<<<
  *             self.col1 = FloatList(initial_len=N)
  *             self.col2 = FloatList(initial_len=N)
  */
-          __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-          if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-          __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_12);
           __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
           __Pyx_GIVEREF(__pyx_t_12);
@@ -16572,17 +16646,17 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
           __pyx_v_self->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12);
           __pyx_t_12 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":293
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":301
  *             self.f_index.arr[n_f] = N
  *             self.e_index = IntList(initial_len=N)
  *             self.col1 = FloatList(initial_len=N)             # <<<<<<<<<<<<<<
  *             self.col2 = FloatList(initial_len=N)
  * 
  */
-          __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(((PyObject *)__pyx_t_12));
-          if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-          __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_1);
           __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
           __Pyx_GIVEREF(__pyx_t_1);
@@ -16591,17 +16665,17 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
           __pyx_v_self->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_1);
           __pyx_t_1 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":294
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":302
  *             self.e_index = IntList(initial_len=N)
  *             self.col1 = FloatList(initial_len=N)
  *             self.col2 = FloatList(initial_len=N)             # <<<<<<<<<<<<<<
  * 
  *             # Re-read file, placing words into buckets
  */
-          __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-          if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-          __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_12);
           __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
           __Pyx_GIVEREF(__pyx_t_12);
@@ -16610,21 +16684,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
           __pyx_v_self->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_12);
           __pyx_t_12 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":297
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":305
  * 
  *             # Re-read file, placing words into buckets
  *             f.seek(0)             # <<<<<<<<<<<<<<
  *             for line in f:
  *                 (fword, eword, score1, score2) = line.split()
  */
-          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__seek); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__seek); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_12);
-          __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_1);
           __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":298
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":306
  *             # Re-read file, placing words into buckets
  *             f.seek(0)
  *             for line in f:             # <<<<<<<<<<<<<<
@@ -16635,7 +16709,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
             __pyx_t_1 = __pyx_v_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
             __pyx_t_9 = NULL;
           } else {
-            __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_1);
             __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext;
           }
@@ -16643,42 +16717,41 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
             if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) {
               if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
               #if CYTHON_COMPILING_IN_CPYTHON
-              __pyx_t_12 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_12); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_12 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_12); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #else
-              __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #endif
             } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) {
               if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
               #if CYTHON_COMPILING_IN_CPYTHON
-              __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_12); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_12); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #else
-              __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #endif
             } else {
               __pyx_t_12 = __pyx_t_9(__pyx_t_1);
               if (unlikely(!__pyx_t_12)) {
                 if (PyErr_Occurred()) {
                   if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
-                  else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+                  else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                 }
                 break;
               }
               __Pyx_GOTREF(__pyx_t_12);
             }
-            __Pyx_XDECREF(__pyx_v_line);
-            __pyx_v_line = __pyx_t_12;
+            __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_12);
             __pyx_t_12 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":299
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":307
  *             f.seek(0)
  *             for line in f:
  *                 (fword, eword, score1, score2) = line.split()             # <<<<<<<<<<<<<<
  *                 f_id = self.get_f_id(fword)
  *                 e_id = self.get_e_id(eword)
  */
-            __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_12);
-            __pyx_t_3 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_3 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_3);
             __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
             if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
@@ -16691,7 +16764,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
               if (unlikely(size != 4)) {
                 if (size > 4) __Pyx_RaiseTooManyValuesError(4);
                 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-                {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+                {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               }
               #if CYTHON_COMPILING_IN_CPYTHON
               if (likely(PyTuple_CheckExact(sequence))) {
@@ -16713,7 +16786,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
               Py_ssize_t i;
               PyObject** temps[4] = {&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__pyx_t_2};
               for (i=0; i < 4; i++) {
-                PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+                PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                 __Pyx_GOTREF(item);
                 *(temps[i]) = item;
               }
@@ -16723,7 +16796,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
             {
               Py_ssize_t index = -1;
               PyObject** temps[4] = {&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__pyx_t_2};
-              __pyx_t_13 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_13 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_GOTREF(__pyx_t_13);
               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
               __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
@@ -16732,7 +16805,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
                 __Pyx_GOTREF(item);
                 *(temps[index]) = item;
               }
-              if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __pyx_t_14 = NULL;
               __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
               goto __pyx_L27_unpacking_done;
@@ -16740,136 +16813,129 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
               __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
               __pyx_t_14 = NULL;
               if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
-              {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __pyx_L27_unpacking_done:;
             }
-            __Pyx_XDECREF(__pyx_v_fword);
-            __pyx_v_fword = __pyx_t_12;
+            __Pyx_XDECREF_SET(__pyx_v_fword, __pyx_t_12);
             __pyx_t_12 = 0;
-            __Pyx_XDECREF(__pyx_v_eword);
-            __pyx_v_eword = __pyx_t_11;
+            __Pyx_XDECREF_SET(__pyx_v_eword, __pyx_t_11);
             __pyx_t_11 = 0;
-            __Pyx_XDECREF(__pyx_v_score1);
-            __pyx_v_score1 = __pyx_t_10;
+            __Pyx_XDECREF_SET(__pyx_v_score1, __pyx_t_10);
             __pyx_t_10 = 0;
-            __Pyx_XDECREF(__pyx_v_score2);
-            __pyx_v_score2 = __pyx_t_2;
+            __Pyx_XDECREF_SET(__pyx_v_score2, __pyx_t_2);
             __pyx_t_2 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":300
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":308
  *             for line in f:
  *                 (fword, eword, score1, score2) = line.split()
  *                 f_id = self.get_f_id(fword)             # <<<<<<<<<<<<<<
  *                 e_id = self.get_e_id(eword)
  *                 index = self.f_index.arr[f_id] + fcount.arr[f_id]
  */
-            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_f_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_f_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_3);
-            __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_2);
             __Pyx_INCREF(__pyx_v_fword);
             PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fword);
             __Pyx_GIVEREF(__pyx_v_fword);
-            __pyx_t_10 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_10 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_10);
             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
             __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-            __Pyx_XDECREF(__pyx_v_f_id);
-            __pyx_v_f_id = __pyx_t_10;
+            __Pyx_XDECREF_SET(__pyx_v_f_id, __pyx_t_10);
             __pyx_t_10 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":301
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":309
  *                 (fword, eword, score1, score2) = line.split()
  *                 f_id = self.get_f_id(fword)
  *                 e_id = self.get_e_id(eword)             # <<<<<<<<<<<<<<
  *                 index = self.f_index.arr[f_id] + fcount.arr[f_id]
  *                 fcount.arr[f_id] = fcount.arr[f_id] + 1
  */
-            __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_e_id); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_e_id); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_10);
-            __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_2);
             __Pyx_INCREF(__pyx_v_eword);
             PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_eword);
             __Pyx_GIVEREF(__pyx_v_eword);
-            __pyx_t_3 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_3 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_3);
             __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
             __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-            __Pyx_XDECREF(__pyx_v_e_id);
-            __pyx_v_e_id = __pyx_t_3;
+            __Pyx_XDECREF_SET(__pyx_v_e_id, __pyx_t_3);
             __pyx_t_3 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":302
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":310
  *                 f_id = self.get_f_id(fword)
  *                 e_id = self.get_e_id(eword)
  *                 index = self.f_index.arr[f_id] + fcount.arr[f_id]             # <<<<<<<<<<<<<<
  *                 fcount.arr[f_id] = fcount.arr[f_id] + 1
  *                 self.e_index.arr[index] = int(e_id)
  */
-            __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-            __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-            __pyx_t_3 = PyInt_FromLong(((__pyx_v_self->f_index->arr[__pyx_t_15]) + (__pyx_v_fcount->arr[__pyx_t_17]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_3 = PyInt_FromLong(((__pyx_v_self->f_index->arr[__pyx_t_15]) + (__pyx_v_fcount->arr[__pyx_t_17]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_3);
-            __Pyx_XDECREF(__pyx_v_index);
-            __pyx_v_index = __pyx_t_3;
+            __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_3);
             __pyx_t_3 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":303
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":311
  *                 e_id = self.get_e_id(eword)
  *                 index = self.f_index.arr[f_id] + fcount.arr[f_id]
  *                 fcount.arr[f_id] = fcount.arr[f_id] + 1             # <<<<<<<<<<<<<<
  *                 self.e_index.arr[index] = int(e_id)
  *                 self.col1[index] = float(score1)
  */
-            __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-            __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             (__pyx_v_fcount->arr[__pyx_t_15]) = ((__pyx_v_fcount->arr[__pyx_t_17]) + 1);
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":304
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":312
  *                 index = self.f_index.arr[f_id] + fcount.arr[f_id]
  *                 fcount.arr[f_id] = fcount.arr[f_id] + 1
  *                 self.e_index.arr[index] = int(e_id)             # <<<<<<<<<<<<<<
  *                 self.col1[index] = float(score1)
  *                 self.col2[index] = float(score2)
  */
-            __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_3);
             __Pyx_INCREF(__pyx_v_e_id);
             PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_e_id);
             __Pyx_GIVEREF(__pyx_v_e_id);
-            __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_2);
             __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-            __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-            __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             (__pyx_v_self->e_index->arr[__pyx_t_17]) = __pyx_t_20;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":305
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":313
  *                 fcount.arr[f_id] = fcount.arr[f_id] + 1
  *                 self.e_index.arr[index] = int(e_id)
  *                 self.col1[index] = float(score1)             # <<<<<<<<<<<<<<
  *                 self.col2[index] = float(score2)
  * 
  */
-            __pyx_t_21 = __Pyx_PyObject_AsDouble(__pyx_v_score1); if (unlikely(__pyx_t_21 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-            __pyx_t_2 = PyFloat_FromDouble(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_21 = __Pyx_PyObject_AsDouble(__pyx_v_score1); if (unlikely(__pyx_t_21 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_2 = PyFloat_FromDouble(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_2);
-            if (PyObject_SetItem(((PyObject *)__pyx_v_self->col1), __pyx_v_index, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            if (PyObject_SetItem(((PyObject *)__pyx_v_self->col1), __pyx_v_index, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":306
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":314
  *                 self.e_index.arr[index] = int(e_id)
  *                 self.col1[index] = float(score1)
  *                 self.col2[index] = float(score2)             # <<<<<<<<<<<<<<
  * 
  *         # Sort buckets by eword
  */
-            __pyx_t_21 = __Pyx_PyObject_AsDouble(__pyx_v_score2); if (unlikely(__pyx_t_21 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-            __pyx_t_2 = PyFloat_FromDouble(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_21 = __Pyx_PyObject_AsDouble(__pyx_v_score2); if (unlikely(__pyx_t_21 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_2 = PyFloat_FromDouble(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_2);
-            if (PyObject_SetItem(((PyObject *)__pyx_v_self->col2), __pyx_v_index, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            if (PyObject_SetItem(((PyObject *)__pyx_v_self->col2), __pyx_v_index, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
           }
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -16887,7 +16953,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-        /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273
+        /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":281
  * 
  *         fcount = IntList()
  *         with gzip_or_text(filename) as f:             # <<<<<<<<<<<<<<
@@ -16896,11 +16962,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
  */
         /*except:*/ {
           __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
-          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
           __Pyx_GOTREF(__pyx_t_1);
           __Pyx_GOTREF(__pyx_t_2);
           __Pyx_GOTREF(__pyx_t_3);
-          __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+          __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
           __Pyx_GOTREF(__pyx_t_10);
           __Pyx_INCREF(__pyx_t_1);
           PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
@@ -16913,11 +16979,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
           __Pyx_GIVEREF(__pyx_t_3);
           __pyx_t_22 = PyObject_Call(__pyx_t_4, __pyx_t_10, NULL);
           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-          if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+          if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
           __Pyx_GOTREF(__pyx_t_22);
           __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_22);
           __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-          if (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+          if (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
           __pyx_t_23 = ((!(__pyx_t_16 != 0)) != 0);
           if (__pyx_t_23) {
             __Pyx_GIVEREF(__pyx_t_1);
@@ -16925,7 +16991,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
             __Pyx_GIVEREF(__pyx_t_3);
             __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
             __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; 
-            {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+            {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
             goto __pyx_L30;
           }
           __pyx_L30:;
@@ -16953,11 +17019,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
       if (__pyx_t_4) {
         __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_k_tuple_46, NULL);
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_t_7);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        if (__pyx_t_23 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (__pyx_t_23 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
     }
     goto __pyx_L31;
@@ -16967,79 +17033,75 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
     __pyx_L31:;
   }
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":309
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":317
  * 
  *         # Sort buckets by eword
  *         for b from 0 <= b < n_f:             # <<<<<<<<<<<<<<
  *             i = self.f_index.arr[b]
  *             j = self.f_index.arr[b+1]
  */
-  if (unlikely(!__pyx_v_n_f)) { __Pyx_RaiseUnboundLocalError("n_f"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-  __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_n_f); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__pyx_v_n_f)) { __Pyx_RaiseUnboundLocalError("n_f"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+  __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_n_f); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_19; __pyx_t_18++) {
-    __pyx_t_3 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_XDECREF(__pyx_v_b);
-    __pyx_v_b = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_b, __pyx_t_3);
     __pyx_t_3 = 0;
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":310
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":318
  *         # Sort buckets by eword
  *         for b from 0 <= b < n_f:
  *             i = self.f_index.arr[b]             # <<<<<<<<<<<<<<
  *             j = self.f_index.arr[b+1]
  *             self.qsort(i,j, "")
  */
-    __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_b); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_b); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
     __pyx_t_3 = 0;
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":311
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":319
  *         for b from 0 <= b < n_f:
  *             i = self.f_index.arr[b]
  *             j = self.f_index.arr[b+1]             # <<<<<<<<<<<<<<
  *             self.qsort(i,j, "")
  * 
  */
-    __pyx_t_3 = PyNumber_Add(__pyx_v_b, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Add(__pyx_v_b, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_XDECREF(__pyx_v_j);
-    __pyx_v_j = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3);
     __pyx_t_3 = 0;
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":312
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":320
  *             i = self.f_index.arr[b]
  *             j = self.f_index.arr[b+1]
  *             self.qsort(i,j, "")             # <<<<<<<<<<<<<<
  * 
  * 
  */
-    __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_24 = __Pyx_PyInt_AsInt(__pyx_v_j); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_t_20, __pyx_t_24, ((PyObject *)__pyx_kp_s_47)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_24 = __Pyx_PyInt_AsInt(__pyx_v_j); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_t_20, __pyx_t_24, ((PyObject *)__pyx_kp_s_47)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_b); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_b); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":309
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":317
  * 
  *         # Sort buckets by eword
  *         for b from 0 <= b < n_f:             # <<<<<<<<<<<<<<
  *             i = self.f_index.arr[b]
  *             j = self.f_index.arr[b+1]
  */
-  __pyx_t_3 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_v_b);
-  __pyx_v_b = __pyx_t_3;
+  __Pyx_XDECREF_SET(__pyx_v_b, __pyx_t_3);
   __pyx_t_3 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -17075,7 +17137,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cd
   return __pyx_r;
 }
 
-/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":315
+/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":323
  * 
  * 
  *     cdef swap(self, int i, int j):             # <<<<<<<<<<<<<<
@@ -17091,7 +17153,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("swap", 0);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":319
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":327
  *         cdef float ftmp
  * 
  *         if i == j:             # <<<<<<<<<<<<<<
@@ -17101,7 +17163,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
   __pyx_t_1 = ((__pyx_v_i == __pyx_v_j) != 0);
   if (__pyx_t_1) {
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":320
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":328
  * 
  *         if i == j:
  *             return             # <<<<<<<<<<<<<<
@@ -17115,7 +17177,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
   }
   __pyx_L3:;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":322
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":330
  *             return
  * 
  *         itmp = self.e_index.arr[i]             # <<<<<<<<<<<<<<
@@ -17124,7 +17186,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
  */
   __pyx_v_itmp = (__pyx_v_self->e_index->arr[__pyx_v_i]);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":323
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":331
  * 
  *         itmp = self.e_index.arr[i]
  *         self.e_index.arr[i] = self.e_index.arr[j]             # <<<<<<<<<<<<<<
@@ -17133,7 +17195,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
  */
   (__pyx_v_self->e_index->arr[__pyx_v_i]) = (__pyx_v_self->e_index->arr[__pyx_v_j]);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":324
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":332
  *         itmp = self.e_index.arr[i]
  *         self.e_index.arr[i] = self.e_index.arr[j]
  *         self.e_index.arr[j] = itmp             # <<<<<<<<<<<<<<
@@ -17142,7 +17204,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
  */
   (__pyx_v_self->e_index->arr[__pyx_v_j]) = __pyx_v_itmp;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":326
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":334
  *         self.e_index.arr[j] = itmp
  * 
  *         ftmp = self.col1.arr[i]             # <<<<<<<<<<<<<<
@@ -17151,7 +17213,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
  */
   __pyx_v_ftmp = (__pyx_v_self->col1->arr[__pyx_v_i]);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":327
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":335
  * 
  *         ftmp = self.col1.arr[i]
  *         self.col1.arr[i] = self.col1.arr[j]             # <<<<<<<<<<<<<<
@@ -17160,7 +17222,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
  */
   (__pyx_v_self->col1->arr[__pyx_v_i]) = (__pyx_v_self->col1->arr[__pyx_v_j]);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":328
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":336
  *         ftmp = self.col1.arr[i]
  *         self.col1.arr[i] = self.col1.arr[j]
  *         self.col1.arr[j] = ftmp             # <<<<<<<<<<<<<<
@@ -17169,7 +17231,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
  */
   (__pyx_v_self->col1->arr[__pyx_v_j]) = __pyx_v_ftmp;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":330
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":338
  *         self.col1.arr[j] = ftmp
  * 
  *         ftmp = self.col2.arr[i]             # <<<<<<<<<<<<<<
@@ -17178,7 +17240,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
  */
   __pyx_v_ftmp = (__pyx_v_self->col2->arr[__pyx_v_i]);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":331
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":339
  * 
  *         ftmp = self.col2.arr[i]
  *         self.col2.arr[i] = self.col2.arr[j]             # <<<<<<<<<<<<<<
@@ -17187,7 +17249,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
  */
   (__pyx_v_self->col2->arr[__pyx_v_i]) = (__pyx_v_self->col2->arr[__pyx_v_j]);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":332
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":340
  *         ftmp = self.col2.arr[i]
  *         self.col2.arr[i] = self.col2.arr[j]
  *         self.col2.arr[j] = ftmp             # <<<<<<<<<<<<<<
@@ -17203,7 +17265,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
   return __pyx_r;
 }
 
-/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":335
+/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":343
  * 
  * 
  *     cdef qsort(self, int i, int j, pad):             # <<<<<<<<<<<<<<
@@ -17226,7 +17288,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("qsort", 0);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":338
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":346
  *         cdef int pval, p
  * 
  *         if i > j:             # <<<<<<<<<<<<<<
@@ -17236,23 +17298,23 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
   __pyx_t_1 = ((__pyx_v_i > __pyx_v_j) != 0);
   if (__pyx_t_1) {
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":339
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":347
  * 
  *         if i > j:
  *             raise Exception("Sort error in CLex")             # <<<<<<<<<<<<<<
  *         if i == j: #empty interval
  *             return
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":340
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":348
  *         if i > j:
  *             raise Exception("Sort error in CLex")
  *         if i == j: #empty interval             # <<<<<<<<<<<<<<
@@ -17262,7 +17324,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
   __pyx_t_1 = ((__pyx_v_i == __pyx_v_j) != 0);
   if (__pyx_t_1) {
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":341
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":349
  *             raise Exception("Sort error in CLex")
  *         if i == j: #empty interval
  *             return             # <<<<<<<<<<<<<<
@@ -17276,7 +17338,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
   }
   __pyx_L4:;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":342
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":350
  *         if i == j: #empty interval
  *             return
  *         if i == j-1: # singleton interval             # <<<<<<<<<<<<<<
@@ -17286,7 +17348,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
   __pyx_t_1 = ((__pyx_v_i == (__pyx_v_j - 1)) != 0);
   if (__pyx_t_1) {
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":343
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":351
  *             return
  *         if i == j-1: # singleton interval
  *             return             # <<<<<<<<<<<<<<
@@ -17300,7 +17362,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
   }
   __pyx_L5:;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":345
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":353
  *             return
  * 
  *         p = (i+j)/2             # <<<<<<<<<<<<<<
@@ -17309,7 +17371,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
  */
   __pyx_v_p = __Pyx_div_long((__pyx_v_i + __pyx_v_j), 2);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":346
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":354
  * 
  *         p = (i+j)/2
  *         pval = self.e_index.arr[p]             # <<<<<<<<<<<<<<
@@ -17318,18 +17380,18 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
  */
   __pyx_v_pval = (__pyx_v_self->e_index->arr[__pyx_v_p]);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":347
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":355
  *         p = (i+j)/2
  *         pval = self.e_index.arr[p]
  *         self.swap(i, p)             # <<<<<<<<<<<<<<
  *         p = i
  *         for k from i+1 <= k < j:
  */
-  __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->swap(__pyx_v_self, __pyx_v_i, __pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->swap(__pyx_v_self, __pyx_v_i, __pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":348
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":356
  *         pval = self.e_index.arr[p]
  *         self.swap(i, p)
  *         p = i             # <<<<<<<<<<<<<<
@@ -17338,7 +17400,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
  */
   __pyx_v_p = __pyx_v_i;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":349
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":357
  *         self.swap(i, p)
  *         p = i
  *         for k from i+1 <= k < j:             # <<<<<<<<<<<<<<
@@ -17348,7 +17410,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
   __pyx_t_3 = __pyx_v_j;
   for (__pyx_v_k = (__pyx_v_i + 1); __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":350
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":358
  *         p = i
  *         for k from i+1 <= k < j:
  *             if pval >= self.e_index.arr[k]:             # <<<<<<<<<<<<<<
@@ -17358,29 +17420,29 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
     __pyx_t_1 = ((__pyx_v_pval >= (__pyx_v_self->e_index->arr[__pyx_v_k])) != 0);
     if (__pyx_t_1) {
 
-      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":351
+      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359
  *         for k from i+1 <= k < j:
  *             if pval >= self.e_index.arr[k]:
  *                 self.swap(p+1, k)             # <<<<<<<<<<<<<<
  *                 self.swap(p, p+1)
  *                 p = p + 1
  */
-      __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->swap(__pyx_v_self, (__pyx_v_p + 1), __pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->swap(__pyx_v_self, (__pyx_v_p + 1), __pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":352
+      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":360
  *             if pval >= self.e_index.arr[k]:
  *                 self.swap(p+1, k)
  *                 self.swap(p, p+1)             # <<<<<<<<<<<<<<
  *                 p = p + 1
  *         self.qsort(i,p, pad+"    ")
  */
-      __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->swap(__pyx_v_self, __pyx_v_p, (__pyx_v_p + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->swap(__pyx_v_self, __pyx_v_p, (__pyx_v_p + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":353
+      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":361
  *                 self.swap(p+1, k)
  *                 self.swap(p, p+1)
  *                 p = p + 1             # <<<<<<<<<<<<<<
@@ -17393,30 +17455,30 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
     __pyx_L8:;
   }
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":354
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":362
  *                 self.swap(p, p+1)
  *                 p = p + 1
  *         self.qsort(i,p, pad+"    ")             # <<<<<<<<<<<<<<
  *         self.qsort(p+1,j, pad+"    ")
  * 
  */
-  __pyx_t_2 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_50)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_50)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_v_i, __pyx_v_p, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_v_i, __pyx_v_p, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":355
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":363
  *                 p = p + 1
  *         self.qsort(i,p, pad+"    ")
  *         self.qsort(p+1,j, pad+"    ")             # <<<<<<<<<<<<<<
  * 
  * 
  */
-  __pyx_t_4 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_50)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_50)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, (__pyx_v_p + 1), __pyx_v_j, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, (__pyx_v_p + 1), __pyx_v_j, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -17435,8 +17497,8 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) {
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) {
   char *__pyx_v_filename;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -17445,7 +17507,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced(PyObject *__pyx
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("write_enhanced (wrapper)", 0);
   assert(__pyx_arg_filename); {
-    __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L3_error:;
@@ -17453,12 +17515,12 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced(PyObject *__pyx
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename));
+  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":358
+/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":366
  * 
  * 
  *     def write_enhanced(self, char* filename):             # <<<<<<<<<<<<<<
@@ -17466,7 +17528,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced(PyObject *__pyx
  *             for i in self.f_index:
  */
 
-static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) {
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) {
   PyObject *__pyx_v_f = NULL;
   PyObject *__pyx_v_i = NULL;
   PyObject *__pyx_v_s1 = NULL;
@@ -17495,7 +17557,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("write_enhanced", 0);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":367
  * 
  *     def write_enhanced(self, char* filename):
  *         with open(filename, "w") as f:             # <<<<<<<<<<<<<<
@@ -17503,9 +17565,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
  *                 f.write("%d " % i)
  */
   /*with:*/ {
-    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
@@ -17513,14 +17575,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
     PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w));
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w));
     __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -17535,7 +17597,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
           __pyx_v_f = __pyx_t_4;
           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":360
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":368
  *     def write_enhanced(self, char* filename):
  *         with open(filename, "w") as f:
  *             for i in self.f_index:             # <<<<<<<<<<<<<<
@@ -17546,7 +17608,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
             __pyx_t_4 = ((PyObject *)__pyx_v_self->f_index); __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
             __pyx_t_9 = NULL;
           } else {
-            __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->f_index)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->f_index)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_4);
             __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
           }
@@ -17554,49 +17616,48 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
             if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) {
               if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
               #if CYTHON_COMPILING_IN_CPYTHON
-              __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #else
-              __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #endif
             } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_4)) {
               if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
               #if CYTHON_COMPILING_IN_CPYTHON
-              __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #else
-              __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #endif
             } else {
               __pyx_t_1 = __pyx_t_9(__pyx_t_4);
               if (unlikely(!__pyx_t_1)) {
                 if (PyErr_Occurred()) {
                   if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
-                  else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+                  else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                 }
                 break;
               }
               __Pyx_GOTREF(__pyx_t_1);
             }
-            __Pyx_XDECREF(__pyx_v_i);
-            __pyx_v_i = __pyx_t_1;
+            __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
             __pyx_t_1 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":361
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":369
  *         with open(filename, "w") as f:
  *             for i in self.f_index:
  *                 f.write("%d " % i)             # <<<<<<<<<<<<<<
  *             f.write("\n")
  *             for i, s1, s2 in zip(self.e_index, self.col1, self.col2):
  */
-            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_1);
-            __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-            __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_10);
             PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_2));
             __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
             __pyx_t_2 = 0;
-            __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_2);
             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
             __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
@@ -17604,28 +17665,28 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
           }
           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":362
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":370
  *             for i in self.f_index:
  *                 f.write("%d " % i)
  *             f.write("\n")             # <<<<<<<<<<<<<<
  *             for i, s1, s2 in zip(self.e_index, self.col1, self.col2):
  *                 f.write("%d %f %f " % (i, s1, s2))
  */
-          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_4);
-          __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_2);
           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":363
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":371
  *                 f.write("%d " % i)
  *             f.write("\n")
  *             for i, s1, s2 in zip(self.e_index, self.col1, self.col2):             # <<<<<<<<<<<<<<
  *                 f.write("%d %f %f " % (i, s1, s2))
  *             f.write("\n")
  */
-          __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_2);
           __Pyx_INCREF(((PyObject *)__pyx_v_self->e_index));
           PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->e_index));
@@ -17636,14 +17697,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
           __Pyx_INCREF(((PyObject *)__pyx_v_self->col2));
           PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_self->col2));
           __Pyx_GIVEREF(((PyObject *)__pyx_v_self->col2));
-          __pyx_t_4 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_4 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_4);
           __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_8 = 0;
             __pyx_t_9 = NULL;
           } else {
-            __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_2);
             __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext;
           }
@@ -17652,23 +17713,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
             if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_2)) {
               if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
               #if CYTHON_COMPILING_IN_CPYTHON
-              __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #else
-              __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #endif
             } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_2)) {
               if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
               #if CYTHON_COMPILING_IN_CPYTHON
-              __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #else
-              __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #endif
             } else {
               __pyx_t_4 = __pyx_t_9(__pyx_t_2);
               if (unlikely(!__pyx_t_4)) {
                 if (PyErr_Occurred()) {
                   if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
-                  else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+                  else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                 }
                 break;
               }
@@ -17684,7 +17745,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
               if (unlikely(size != 3)) {
                 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
                 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-                {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+                {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               }
               #if CYTHON_COMPILING_IN_CPYTHON
               if (likely(PyTuple_CheckExact(sequence))) {
@@ -17700,18 +17761,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
               __Pyx_INCREF(__pyx_t_1);
               __Pyx_INCREF(__pyx_t_11);
               #else
-              __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_11 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_11 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_GOTREF(__pyx_t_11);
               #endif
               __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
             } else
             {
               Py_ssize_t index = -1;
-              __pyx_t_12 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_12 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_GOTREF(__pyx_t_12);
               __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
               __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
@@ -17721,7 +17782,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
               __Pyx_GOTREF(__pyx_t_1);
               index = 2; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L20_unpacking_failed;
               __Pyx_GOTREF(__pyx_t_11);
-              if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __pyx_t_13 = NULL;
               __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
               goto __pyx_L21_unpacking_done;
@@ -17729,29 +17790,26 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
               __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
               __pyx_t_13 = NULL;
               if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
-              {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __pyx_L21_unpacking_done:;
             }
-            __Pyx_XDECREF(__pyx_v_i);
-            __pyx_v_i = __pyx_t_10;
+            __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_10);
             __pyx_t_10 = 0;
-            __Pyx_XDECREF(__pyx_v_s1);
-            __pyx_v_s1 = __pyx_t_1;
+            __Pyx_XDECREF_SET(__pyx_v_s1, __pyx_t_1);
             __pyx_t_1 = 0;
-            __Pyx_XDECREF(__pyx_v_s2);
-            __pyx_v_s2 = __pyx_t_11;
+            __Pyx_XDECREF_SET(__pyx_v_s2, __pyx_t_11);
             __pyx_t_11 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":364
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":372
  *             f.write("\n")
  *             for i, s1, s2 in zip(self.e_index, self.col1, self.col2):
  *                 f.write("%d %f %f " % (i, s1, s2))             # <<<<<<<<<<<<<<
  *             f.write("\n")
  *             for i, w in enumerate(self.id2fword):
  */
-            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_4);
-            __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_11);
             __Pyx_INCREF(__pyx_v_i);
             PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_i);
@@ -17762,15 +17820,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
             __Pyx_INCREF(__pyx_v_s2);
             PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_s2);
             __Pyx_GIVEREF(__pyx_v_s2);
-            __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(((PyObject *)__pyx_t_1));
             __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
-            __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_11);
             PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_1));
             __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
             __pyx_t_1 = 0;
-            __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_1);
             __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
             __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
@@ -17778,21 +17836,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
           }
           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":365
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":373
  *             for i, s1, s2 in zip(self.e_index, self.col1, self.col2):
  *                 f.write("%d %f %f " % (i, s1, s2))
  *             f.write("\n")             # <<<<<<<<<<<<<<
  *             for i, w in enumerate(self.id2fword):
  *                 f.write("%d %s " % (i, w))
  */
-          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_2);
-          __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L7_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/mdenkows/cdec/python/cdec/sa/bilex.pxi":366
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":374
  *                 f.write("%d %f %f " % (i, s1, s2))
  *             f.write("\n")
  *             for i, w in enumerate(self.id2fword):             # <<<<<<<<<<<<<<
@@ -17805,7 +17863,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
             __pyx_t_2 = __pyx_v_self->id2fword; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
             __pyx_t_9 = NULL;
           } else {
-            __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_self->id2fword); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_self->id2fword); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_2);
             __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext;
           }
@@ -17813,50 +17871,48 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
             if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_2)) {
               if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
               #if CYTHON_COMPILING_IN_CPYTHON
-              __pyx_t_11 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_11 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #else
-              __pyx_t_11 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_11 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #endif
             } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_2)) {
               if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
               #if CYTHON_COMPILING_IN_CPYTHON
-              __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #else
-              __pyx_t_11 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_11 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #endif
             } else {
               __pyx_t_11 = __pyx_t_9(__pyx_t_2);
               if (unlikely(!__pyx_t_11)) {
                 if (PyErr_Occurred()) {
                   if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
-                  else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+                  else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                 }
                 break;
               }
               __Pyx_GOTREF(__pyx_t_11);
             }
-            __Pyx_XDECREF(__pyx_v_w);
-            __pyx_v_w = __pyx_t_11;
+            __Pyx_XDECREF_SET(__pyx_v_w, __pyx_t_11);
             __pyx_t_11 = 0;
             __Pyx_INCREF(__pyx_t_1);
-            __Pyx_XDECREF(__pyx_v_i);
-            __pyx_v_i = __pyx_t_1;
-            __pyx_t_11 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
+            __pyx_t_11 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_11);
             __Pyx_DECREF(__pyx_t_1);
             __pyx_t_1 = __pyx_t_11;
             __pyx_t_11 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":367
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":375
  *             f.write("\n")
  *             for i, w in enumerate(self.id2fword):
  *                 f.write("%d %s " % (i, w))             # <<<<<<<<<<<<<<
  *             f.write("\n")
  *             for i, w in enumerate(self.id2eword):
  */
-            __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_11);
-            __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_4);
             __Pyx_INCREF(__pyx_v_i);
             PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i);
@@ -17864,15 +17920,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
             __Pyx_INCREF(__pyx_v_w);
             PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_w);
             __Pyx_GIVEREF(__pyx_v_w);
-            __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(((PyObject *)__pyx_t_10));
             __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[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_4);
             PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_10));
             __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
             __pyx_t_10 = 0;
-            __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_10);
             __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
             __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
@@ -17881,21 +17937,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":368
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":376
  *             for i, w in enumerate(self.id2fword):
  *                 f.write("%d %s " % (i, w))
  *             f.write("\n")             # <<<<<<<<<<<<<<
  *             for i, w in enumerate(self.id2eword):
  *                 f.write("%d %s " % (i, w))
  */
-          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_1);
-          __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_2);
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":369
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":377
  *                 f.write("%d %s " % (i, w))
  *             f.write("\n")
  *             for i, w in enumerate(self.id2eword):             # <<<<<<<<<<<<<<
@@ -17908,7 +17964,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
             __pyx_t_1 = __pyx_v_self->id2eword; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
             __pyx_t_9 = NULL;
           } else {
-            __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->id2eword); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->id2eword); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_1);
             __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext;
           }
@@ -17916,50 +17972,48 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
             if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) {
               if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
               #if CYTHON_COMPILING_IN_CPYTHON
-              __pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #else
-              __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #endif
             } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) {
               if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
               #if CYTHON_COMPILING_IN_CPYTHON
-              __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #else
-              __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               #endif
             } else {
               __pyx_t_10 = __pyx_t_9(__pyx_t_1);
               if (unlikely(!__pyx_t_10)) {
                 if (PyErr_Occurred()) {
                   if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
-                  else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+                  else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
                 }
                 break;
               }
               __Pyx_GOTREF(__pyx_t_10);
             }
-            __Pyx_XDECREF(__pyx_v_w);
-            __pyx_v_w = __pyx_t_10;
+            __Pyx_XDECREF_SET(__pyx_v_w, __pyx_t_10);
             __pyx_t_10 = 0;
             __Pyx_INCREF(__pyx_t_2);
-            __Pyx_XDECREF(__pyx_v_i);
-            __pyx_v_i = __pyx_t_2;
-            __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
+            __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_10);
             __Pyx_DECREF(__pyx_t_2);
             __pyx_t_2 = __pyx_t_10;
             __pyx_t_10 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":370
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":378
  *             f.write("\n")
  *             for i, w in enumerate(self.id2eword):
  *                 f.write("%d %s " % (i, w))             # <<<<<<<<<<<<<<
  *             f.write("\n")
  * 
  */
-            __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_10);
-            __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_4);
             __Pyx_INCREF(__pyx_v_i);
             PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i);
@@ -17967,15 +18021,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
             __Pyx_INCREF(__pyx_v_w);
             PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_w);
             __Pyx_GIVEREF(__pyx_v_w);
-            __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(((PyObject *)__pyx_t_11));
             __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[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_4);
             PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_11));
             __Pyx_GIVEREF(((PyObject *)__pyx_t_11));
             __pyx_t_11 = 0;
-            __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_11);
             __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
             __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
@@ -17984,16 +18038,16 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":371
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":379
  *             for i, w in enumerate(self.id2eword):
  *                 f.write("%d %s " % (i, w))
  *             f.write("\n")             # <<<<<<<<<<<<<<
  * 
  * 
  */
-          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_2);
-          __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_1);
           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -18010,7 +18064,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-        /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359
+        /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":367
  * 
  *     def write_enhanced(self, char* filename):
  *         with open(filename, "w") as f:             # <<<<<<<<<<<<<<
@@ -18019,11 +18073,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
  */
         /*except:*/ {
           __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename);
-          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
           __Pyx_GOTREF(__pyx_t_1);
           __Pyx_GOTREF(__pyx_t_2);
           __Pyx_GOTREF(__pyx_t_11);
-          __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+          __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
           __Pyx_GOTREF(__pyx_t_4);
           __Pyx_INCREF(__pyx_t_1);
           PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
@@ -18036,11 +18090,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
           __Pyx_GIVEREF(__pyx_t_11);
           __pyx_t_15 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL);
           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+          if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
           __Pyx_GOTREF(__pyx_t_15);
           __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_15);
           __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-          if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+          if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
           __pyx_t_16 = ((!(__pyx_t_14 != 0)) != 0);
           if (__pyx_t_16) {
             __Pyx_GIVEREF(__pyx_t_1);
@@ -18048,7 +18102,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
             __Pyx_GIVEREF(__pyx_t_11);
             __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_11);
             __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_11 = 0; 
-            {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+            {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
             goto __pyx_L28;
           }
           __pyx_L28:;
@@ -18076,11 +18130,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
       if (__pyx_t_3) {
         __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_57, NULL);
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_7);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        if (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
     }
     goto __pyx_L29;
@@ -18113,8 +18167,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_ob
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_19get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_19get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_fword = 0;
   PyObject *__pyx_v_eword = 0;
   PyObject *__pyx_v_col = 0;
@@ -18145,16 +18199,16 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score(PyObject *__pyx_v_se
         case  1:
         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eword)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__col)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_score") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_score") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
       goto __pyx_L5_argtuple_error;
@@ -18169,18 +18223,18 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score(PyObject *__pyx_v_se
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("cdec.sa._sa.BiLex.get_score", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), __pyx_v_fword, __pyx_v_eword, __pyx_v_col);
+  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), __pyx_v_fword, __pyx_v_eword, __pyx_v_col);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":374
+/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":382
  * 
  * 
  *     def get_score(self, fword, eword, col):             # <<<<<<<<<<<<<<
@@ -18188,7 +18242,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score(PyObject *__pyx_v_se
  * 
  */
 
-static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col) {
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col) {
   PyObject *__pyx_v_e_id = 0;
   PyObject *__pyx_v_f_id = 0;
   PyObject *__pyx_v_low = 0;
@@ -18207,18 +18261,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cd
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("get_score", 0);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":377
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":385
  *         cdef e_id, f_id, low, high, midpoint, val
  * 
  *         if eword not in self.eword2id:             # <<<<<<<<<<<<<<
  *             return None
  *         if fword not in self.fword2id:
  */
-  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_eword, __pyx_v_self->eword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_eword, __pyx_v_self->eword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":378
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":386
  * 
  *         if eword not in self.eword2id:
  *             return None             # <<<<<<<<<<<<<<
@@ -18233,18 +18287,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cd
   }
   __pyx_L3:;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":379
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":387
  *         if eword not in self.eword2id:
  *             return None
  *         if fword not in self.fword2id:             # <<<<<<<<<<<<<<
  *             return None
  *         f_id = self.fword2id[fword]
  */
-  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_fword, __pyx_v_self->fword2id, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_fword, __pyx_v_self->fword2id, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_1 = (__pyx_t_2 != 0);
   if (__pyx_t_1) {
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":380
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":388
  *             return None
  *         if fword not in self.fword2id:
  *             return None             # <<<<<<<<<<<<<<
@@ -18259,60 +18313,60 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cd
   }
   __pyx_L4:;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":381
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":389
  *         if fword not in self.fword2id:
  *             return None
  *         f_id = self.fword2id[fword]             # <<<<<<<<<<<<<<
  *         e_id = self.eword2id[eword]
  *         low = self.f_index.arr[f_id]
  */
-  __pyx_t_3 = PyObject_GetItem(__pyx_v_self->fword2id, __pyx_v_fword); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetItem(__pyx_v_self->fword2id, __pyx_v_fword); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_v_f_id = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":382
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":390
  *             return None
  *         f_id = self.fword2id[fword]
  *         e_id = self.eword2id[eword]             # <<<<<<<<<<<<<<
  *         low = self.f_index.arr[f_id]
  *         high = self.f_index.arr[f_id+1]
  */
-  __pyx_t_3 = PyObject_GetItem(__pyx_v_self->eword2id, __pyx_v_eword); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetItem(__pyx_v_self->eword2id, __pyx_v_eword); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_v_e_id = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":383
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":391
  *         f_id = self.fword2id[fword]
  *         e_id = self.eword2id[eword]
  *         low = self.f_index.arr[f_id]             # <<<<<<<<<<<<<<
  *         high = self.f_index.arr[f_id+1]
  *         while high - low > 0:
  */
-  __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_v_low = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":384
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":392
  *         e_id = self.eword2id[eword]
  *         low = self.f_index.arr[f_id]
  *         high = self.f_index.arr[f_id+1]             # <<<<<<<<<<<<<<
  *         while high - low > 0:
  *             midpoint = (low+high)/2
  */
-  __pyx_t_3 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_v_high = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":385
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":393
  *         low = self.f_index.arr[f_id]
  *         high = self.f_index.arr[f_id+1]
  *         while high - low > 0:             # <<<<<<<<<<<<<<
@@ -18320,69 +18374,67 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cd
  *             val = self.e_index.arr[midpoint]
  */
   while (1) {
-    __pyx_t_3 = PyNumber_Subtract(__pyx_v_high, __pyx_v_low); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Subtract(__pyx_v_high, __pyx_v_low); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (!__pyx_t_1) break;
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":386
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":394
  *         high = self.f_index.arr[f_id+1]
  *         while high - low > 0:
  *             midpoint = (low+high)/2             # <<<<<<<<<<<<<<
  *             val = self.e_index.arr[midpoint]
  *             if val == e_id:
  */
-    __pyx_t_5 = PyNumber_Add(__pyx_v_low, __pyx_v_high); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyNumber_Add(__pyx_v_low, __pyx_v_high); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_int_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_int_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_XDECREF(__pyx_v_midpoint);
-    __pyx_v_midpoint = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_midpoint, __pyx_t_3);
     __pyx_t_3 = 0;
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":387
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":395
  *         while high - low > 0:
  *             midpoint = (low+high)/2
  *             val = self.e_index.arr[midpoint]             # <<<<<<<<<<<<<<
  *             if val == e_id:
  *                 if col == 0:
  */
-    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = PyInt_FromLong((__pyx_v_self->e_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyInt_FromLong((__pyx_v_self->e_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_XDECREF(__pyx_v_val);
-    __pyx_v_val = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_3);
     __pyx_t_3 = 0;
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":388
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":396
  *             midpoint = (low+high)/2
  *             val = self.e_index.arr[midpoint]
  *             if val == e_id:             # <<<<<<<<<<<<<<
  *                 if col == 0:
  *                     return self.col1.arr[midpoint]
  */
-    __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     if (__pyx_t_1) {
 
-      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":389
+      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":397
  *             val = self.e_index.arr[midpoint]
  *             if val == e_id:
  *                 if col == 0:             # <<<<<<<<<<<<<<
  *                     return self.col1.arr[midpoint]
  *                 if col == 1:
  */
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_col, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_col, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       if (__pyx_t_1) {
 
-        /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":390
+        /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":398
  *             if val == e_id:
  *                 if col == 0:
  *                     return self.col1.arr[midpoint]             # <<<<<<<<<<<<<<
@@ -18390,8 +18442,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cd
  *                     return self.col2.arr[midpoint]
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->col1->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->col1->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
         __pyx_r = __pyx_t_3;
         __pyx_t_3 = 0;
@@ -18400,19 +18452,19 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cd
       }
       __pyx_L8:;
 
-      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":391
+      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":399
  *                 if col == 0:
  *                     return self.col1.arr[midpoint]
  *                 if col == 1:             # <<<<<<<<<<<<<<
  *                     return self.col2.arr[midpoint]
  *             if val > e_id:
  */
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_col, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_col, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       if (__pyx_t_1) {
 
-        /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":392
+        /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":400
  *                     return self.col1.arr[midpoint]
  *                 if col == 1:
  *                     return self.col2.arr[midpoint]             # <<<<<<<<<<<<<<
@@ -18420,8 +18472,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cd
  *                 high = midpoint
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->col2->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->col2->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
         __pyx_r = __pyx_t_3;
         __pyx_t_3 = 0;
@@ -18433,19 +18485,19 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cd
     }
     __pyx_L7:;
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":393
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":401
  *                 if col == 1:
  *                     return self.col2.arr[midpoint]
  *             if val > e_id:             # <<<<<<<<<<<<<<
  *                 high = midpoint
  *             if val < e_id:
  */
-    __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     if (__pyx_t_1) {
 
-      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":394
+      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":402
  *                     return self.col2.arr[midpoint]
  *             if val > e_id:
  *                 high = midpoint             # <<<<<<<<<<<<<<
@@ -18453,42 +18505,40 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cd
  *                 low = midpoint + 1
  */
       __Pyx_INCREF(__pyx_v_midpoint);
-      __Pyx_DECREF(__pyx_v_high);
-      __pyx_v_high = __pyx_v_midpoint;
+      __Pyx_DECREF_SET(__pyx_v_high, __pyx_v_midpoint);
       goto __pyx_L10;
     }
     __pyx_L10:;
 
-    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":395
+    /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":403
  *             if val > e_id:
  *                 high = midpoint
  *             if val < e_id:             # <<<<<<<<<<<<<<
  *                 low = midpoint + 1
  *         return None
  */
-    __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     if (__pyx_t_1) {
 
-      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":396
+      /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404
  *                 high = midpoint
  *             if val < e_id:
  *                 low = midpoint + 1             # <<<<<<<<<<<<<<
  *         return None
  * 
  */
-      __pyx_t_3 = PyNumber_Add(__pyx_v_midpoint, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyNumber_Add(__pyx_v_midpoint, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_v_low);
-      __pyx_v_low = __pyx_t_3;
+      __Pyx_DECREF_SET(__pyx_v_low, __pyx_t_3);
       __pyx_t_3 = 0;
       goto __pyx_L11;
     }
     __pyx_L11:;
   }
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":397
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":405
  *             if val < e_id:
  *                 low = midpoint + 1
  *         return None             # <<<<<<<<<<<<<<
@@ -18520,9 +18570,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cd
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/
-static char __pyx_doc_4cdec_2sa_3_sa_5BiLex_16write_text[] = "Note: does not guarantee writing the dictionary in the original order";
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) {
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_21write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/
+static char __pyx_doc_4cdec_2sa_3_sa_5BiLex_20write_text[] = "Note: does not guarantee writing the dictionary in the original order";
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_21write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) {
   char *__pyx_v_filename;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -18531,7 +18581,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text(PyObject *__pyx_v_s
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("write_text (wrapper)", 0);
   assert(__pyx_arg_filename); {
-    __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L3_error:;
@@ -18539,12 +18589,12 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text(PyObject *__pyx_v_s
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename));
+  __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_20write_text(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":400
+/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":408
  * 
  * 
  *     def write_text(self, char* filename):             # <<<<<<<<<<<<<<
@@ -18552,7 +18602,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text(PyObject *__pyx_v_s
  *         cdef i, N, e_id, f_id
  */
 
-static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) {
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_20write_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) {
   PyObject *__pyx_v_i = 0;
   PyObject *__pyx_v_N = 0;
   PyObject *__pyx_v_e_id = 0;
@@ -18581,7 +18631,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4c
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("write_text", 0);
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":412
  *         cdef i, N, e_id, f_id
  * 
  *         with open(filename, "w") as f:             # <<<<<<<<<<<<<<
@@ -18589,9 +18639,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4c
  *             f_id = 0
  */
   /*with:*/ {
-    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
@@ -18599,14 +18649,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4c
     PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w));
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w));
     __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -18621,7 +18671,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4c
           __pyx_v_f = __pyx_t_4;
           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":405
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":413
  * 
  *         with open(filename, "w") as f:
  *             N = len(self.e_index)             # <<<<<<<<<<<<<<
@@ -18630,14 +18680,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4c
  */
           __pyx_t_4 = ((PyObject *)__pyx_v_self->e_index);
           __Pyx_INCREF(__pyx_t_4);
-          __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-          __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_4);
           __pyx_v_N = __pyx_t_4;
           __pyx_t_4 = 0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":406
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":414
  *         with open(filename, "w") as f:
  *             N = len(self.e_index)
  *             f_id = 0             # <<<<<<<<<<<<<<
@@ -18647,22 +18697,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4c
           __Pyx_INCREF(__pyx_int_0);
           __pyx_v_f_id = __pyx_int_0;
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":407
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":415
  *             N = len(self.e_index)
  *             f_id = 0
  *             for i from 0 <= i < N:             # <<<<<<<<<<<<<<
  *                 while self.f_index.arr[f_id+1] == i:
  *                     f_id = f_id + 1
  */
-          __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_v_N); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_v_N); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10++) {
-            __pyx_t_4 = PyInt_FromLong(__pyx_t_10); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_4 = PyInt_FromLong(__pyx_t_10); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_4);
-            __Pyx_XDECREF(__pyx_v_i);
-            __pyx_v_i = __pyx_t_4;
+            __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
             __pyx_t_4 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":408
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":416
  *             f_id = 0
  *             for i from 0 <= i < N:
  *                 while self.f_index.arr[f_id+1] == i:             # <<<<<<<<<<<<<<
@@ -18670,85 +18719,81 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4c
  *                 e_id = self.e_index.arr[i]
  */
             while (1) {
-              __pyx_t_4 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_4 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_GOTREF(__pyx_t_4);
-              __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-              __pyx_t_4 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_4 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_GOTREF(__pyx_t_4);
-              __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-              __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
               if (!__pyx_t_11) break;
 
-              /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":409
+              /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":417
  *             for i from 0 <= i < N:
  *                 while self.f_index.arr[f_id+1] == i:
  *                     f_id = f_id + 1             # <<<<<<<<<<<<<<
  *                 e_id = self.e_index.arr[i]
  *                 score1 = self.col1.arr[i]
  */
-              __pyx_t_1 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+              __pyx_t_1 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_v_f_id);
-              __pyx_v_f_id = __pyx_t_1;
+              __Pyx_DECREF_SET(__pyx_v_f_id, __pyx_t_1);
               __pyx_t_1 = 0;
             }
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":410
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":418
  *                 while self.f_index.arr[f_id+1] == i:
  *                     f_id = f_id + 1
  *                 e_id = self.e_index.arr[i]             # <<<<<<<<<<<<<<
  *                 score1 = self.col1.arr[i]
  *                 score2 = self.col2.arr[i]
  */
-            __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-            __pyx_t_1 = PyInt_FromLong((__pyx_v_self->e_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_1 = PyInt_FromLong((__pyx_v_self->e_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_1);
-            __Pyx_XDECREF(__pyx_v_e_id);
-            __pyx_v_e_id = __pyx_t_1;
+            __Pyx_XDECREF_SET(__pyx_v_e_id, __pyx_t_1);
             __pyx_t_1 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":411
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":419
  *                     f_id = f_id + 1
  *                 e_id = self.e_index.arr[i]
  *                 score1 = self.col1.arr[i]             # <<<<<<<<<<<<<<
  *                 score2 = self.col2.arr[i]
  *                 f.write("%s %s %.6f %.6f\n" % (self.id2fword[f_id], self.id2eword[e_id], score1, score2))
  */
-            __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-            __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->col1->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->col1->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_1);
-            __Pyx_XDECREF(__pyx_v_score1);
-            __pyx_v_score1 = __pyx_t_1;
+            __Pyx_XDECREF_SET(__pyx_v_score1, __pyx_t_1);
             __pyx_t_1 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":412
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":420
  *                 e_id = self.e_index.arr[i]
  *                 score1 = self.col1.arr[i]
  *                 score2 = self.col2.arr[i]             # <<<<<<<<<<<<<<
  *                 f.write("%s %s %.6f %.6f\n" % (self.id2fword[f_id], self.id2eword[e_id], score1, score2))
  */
-            __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-            __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->col2->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->col2->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_1);
-            __Pyx_XDECREF(__pyx_v_score2);
-            __pyx_v_score2 = __pyx_t_1;
+            __Pyx_XDECREF_SET(__pyx_v_score2, __pyx_t_1);
             __pyx_t_1 = 0;
 
-            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":413
+            /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":421
  *                 score1 = self.col1.arr[i]
  *                 score2 = self.col2.arr[i]
  *                 f.write("%s %s %.6f %.6f\n" % (self.id2fword[f_id], self.id2eword[e_id], score1, score2))             # <<<<<<<<<<<<<<
  */
-            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_1);
-            __pyx_t_4 = PyObject_GetItem(__pyx_v_self->id2fword, __pyx_v_f_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_4 = PyObject_GetItem(__pyx_v_self->id2fword, __pyx_v_f_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_4);
-            __pyx_t_2 = PyObject_GetItem(__pyx_v_self->id2eword, __pyx_v_e_id); if (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_2 = PyObject_GetItem(__pyx_v_self->id2eword, __pyx_v_e_id); if (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_2);
-            __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_12);
             PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4);
             __Pyx_GIVEREF(__pyx_t_4);
@@ -18762,33 +18807,32 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4c
             __Pyx_GIVEREF(__pyx_v_score2);
             __pyx_t_4 = 0;
             __pyx_t_2 = 0;
-            __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_58), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_58), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(((PyObject *)__pyx_t_2));
             __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
-            __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_12);
             PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_t_2));
             __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
             __pyx_t_2 = 0;
-            __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
             __Pyx_GOTREF(__pyx_t_2);
             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
             __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-            __pyx_t_10 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+            __pyx_t_10 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           }
 
-          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":407
+          /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":415
  *             N = len(self.e_index)
  *             f_id = 0
  *             for i from 0 <= i < N:             # <<<<<<<<<<<<<<
  *                 while self.f_index.arr[f_id+1] == i:
  *                     f_id = f_id + 1
  */
-          __pyx_t_2 = PyInt_FromLong(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+          __pyx_t_2 = PyInt_FromLong(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
           __Pyx_GOTREF(__pyx_t_2);
-          __Pyx_XDECREF(__pyx_v_i);
-          __pyx_v_i = __pyx_t_2;
+          __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
           __pyx_t_2 = 0;
         }
         __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -18801,7 +18845,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4c
         __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-        /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404
+        /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":412
  *         cdef i, N, e_id, f_id
  * 
  *         with open(filename, "w") as f:             # <<<<<<<<<<<<<<
@@ -18810,11 +18854,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4c
  */
         /*except:*/ {
           __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
-          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_12, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_12, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
           __Pyx_GOTREF(__pyx_t_2);
           __Pyx_GOTREF(__pyx_t_12);
           __Pyx_GOTREF(__pyx_t_1);
-          __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+          __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
           __Pyx_GOTREF(__pyx_t_4);
           __Pyx_INCREF(__pyx_t_2);
           PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
@@ -18827,11 +18871,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4c
           __Pyx_GIVEREF(__pyx_t_1);
           __pyx_t_13 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL);
           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+          if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
           __Pyx_GOTREF(__pyx_t_13);
           __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_13);
           __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-          if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+          if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
           __pyx_t_14 = ((!(__pyx_t_11 != 0)) != 0);
           if (__pyx_t_14) {
             __Pyx_GIVEREF(__pyx_t_2);
@@ -18839,7 +18883,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4c
             __Pyx_GIVEREF(__pyx_t_1);
             __Pyx_ErrRestore(__pyx_t_2, __pyx_t_12, __pyx_t_1);
             __pyx_t_2 = 0; __pyx_t_12 = 0; __pyx_t_1 = 0; 
-            {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+            {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
             goto __pyx_L22;
           }
           __pyx_L22:;
@@ -18867,11 +18911,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4c
       if (__pyx_t_3) {
         __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_59, NULL);
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
     }
     goto __pyx_L23;
@@ -20201,8 +20245,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) {
  */
       __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s__0), ((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __Pyx_DECREF(((PyObject *)__pyx_v_result));
-      __pyx_v_result = ((PyObject*)__pyx_t_4);
+      __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_4));
       __pyx_t_4 = 0;
       goto __pyx_L5;
     }
@@ -20217,8 +20260,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) {
  */
       __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s__1), ((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __Pyx_DECREF(((PyObject *)__pyx_v_result));
-      __pyx_v_result = ((PyObject*)__pyx_t_4);
+      __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_4));
       __pyx_t_4 = 0;
     }
     __pyx_L5:;
@@ -22798,9 +22840,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
         __Pyx_GOTREF(__pyx_t_2);
         if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start));
-        __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start));
+        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_ngram_start, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2));
         __Pyx_GIVEREF(__pyx_t_2);
-        __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2);
         __pyx_t_2 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":68
@@ -22889,9 +22930,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
       __Pyx_GOTREF(__pyx_t_2);
       if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start));
-      __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start));
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_ngram_start, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2));
       __Pyx_GIVEREF(__pyx_t_2);
-      __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2);
       __pyx_t_2 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":76
@@ -23017,9 +23057,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
           __Pyx_GOTREF(((PyObject *)__pyx_t_3));
           __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
           __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram));
-          __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram));
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_ngram, ((PyObject*)__pyx_t_3));
           __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-          __pyx_cur_scope->__pyx_v_ngram = ((PyObject*)__pyx_t_3);
           __pyx_t_3 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":86
@@ -24318,9 +24357,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_2generator7(__pyx_Genera
       __Pyx_GOTREF(__pyx_t_4);
     }
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_word, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_cur_scope->__pyx_v_word = __pyx_t_4;
     __pyx_t_4 = 0;
     __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_cur_scope->__pyx_v_word); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_5, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -24463,9 +24501,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_5generator8(__pyx_Genera
       __Pyx_GOTREF(__pyx_t_4);
     }
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_word, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_cur_scope->__pyx_v_word = __pyx_t_4;
     __pyx_t_4 = 0;
     __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
@@ -24794,19 +24831,16 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_Gene
       __pyx_L7_unpacking_done:;
     }
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sym);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sym);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_sym, __pyx_t_5);
     __Pyx_GIVEREF(__pyx_t_5);
-    __pyx_cur_scope->__pyx_v_sym = __pyx_t_5;
     __pyx_t_5 = 0;
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_weight);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_weight);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_weight, __pyx_t_6);
     __Pyx_GIVEREF(__pyx_t_6);
-    __pyx_cur_scope->__pyx_v_weight = __pyx_t_6;
     __pyx_t_6 = 0;
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_dist);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_dist);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_dist, __pyx_t_7);
     __Pyx_GIVEREF(__pyx_t_7);
-    __pyx_cur_scope->__pyx_v_dist = __pyx_t_7;
     __pyx_t_7 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":116
@@ -24852,9 +24886,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_Gene
         __Pyx_GOTREF(__pyx_t_7);
       }
       __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_arc);
-      __Pyx_DECREF(__pyx_cur_scope->__pyx_v_arc);
+      __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_arc, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
-      __pyx_cur_scope->__pyx_v_arc = __pyx_t_7;
       __pyx_t_7 = 0;
       if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) { __Pyx_RaiseClosureNameError("lattice"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
       if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) {
@@ -24892,9 +24925,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_Gene
           __Pyx_GOTREF(__pyx_t_6);
         }
         __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node);
-        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_node);
+        __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_node, __pyx_t_6);
         __Pyx_GIVEREF(__pyx_t_6);
-        __pyx_cur_scope->__pyx_v_node = __pyx_t_6;
         __pyx_t_6 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":115
@@ -25266,19 +25298,16 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_15decode_sentence_2generator10(__pyx_Ge
       __pyx_L9_unpacking_done:;
     }
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sym);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sym);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_sym, __pyx_t_6);
     __Pyx_GIVEREF(__pyx_t_6);
-    __pyx_cur_scope->__pyx_v_sym = __pyx_t_6;
     __pyx_t_6 = 0;
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v__);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v__);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v__, __pyx_t_8);
     __Pyx_GIVEREF(__pyx_t_8);
-    __pyx_cur_scope->__pyx_v__ = __pyx_t_8;
     __pyx_t_8 = 0;
     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v__);
-    __Pyx_DECREF(__pyx_cur_scope->__pyx_v__);
+    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v__, __pyx_t_9);
     __Pyx_GIVEREF(__pyx_t_9);
-    __pyx_cur_scope->__pyx_v__ = __pyx_t_9;
     __pyx_t_9 = 0;
     __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_sym); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_11)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -25502,9 +25531,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_12encode_words_2generator11(__pyx_Gener
       __Pyx_GOTREF(__pyx_t_4);
     }
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_word, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_cur_scope->__pyx_v_word = __pyx_t_4;
     __pyx_t_4 = 0;
     __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_cur_scope->__pyx_v_word); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_5, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -25721,9 +25749,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_12decode_words_2generator12(__pyx_Gener
       __Pyx_GOTREF(__pyx_t_4);
     }
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sym);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sym);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_sym, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_cur_scope->__pyx_v_sym = __pyx_t_4;
     __pyx_t_4 = 0;
     __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_sym); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -27717,8 +27744,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_31subst(struct __pyx_obj_4cdec_
       __pyx_t_5 = PyNumber_Add(__pyx_v_start, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_v_start);
-      __pyx_v_start = __pyx_t_5;
+      __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_5);
       __pyx_t_5 = 0;
       goto __pyx_L5;
     }
@@ -27741,8 +27767,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_31subst(struct __pyx_obj_4cdec_
       __pyx_t_5 = PyNumber_Add(__pyx_v_start, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_v_start);
-      __pyx_v_start = __pyx_t_5;
+      __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_5);
       __pyx_t_5 = 0;
     }
     __pyx_L5:;
@@ -27853,8 +27878,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_5words___get__(struct __pyx_obj
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_w);
-    __pyx_v_w = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_w, __pyx_t_5);
     __pyx_t_5 = 0;
     __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_7 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_6) != 0)) != 0);
@@ -28549,9 +28573,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_7__str___2generator13(__pyx_Gener
       __Pyx_GOTREF(__pyx_t_2);
     }
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_a);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_a);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_a, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
-    __pyx_cur_scope->__pyx_v_a = __pyx_t_2;
     __pyx_t_2 = 0;
     __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_71), __pyx_cur_scope->__pyx_v_a); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
@@ -28874,9 +28897,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_14generator3(__pyx_GeneratorObjec
       __Pyx_GOTREF(__pyx_t_4);
     }
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_point);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_point);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_point, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_cur_scope->__pyx_v_point = __pyx_t_4;
     __pyx_t_4 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":191
@@ -29849,8 +29871,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(struct __pyx_t_4cdec_2s
     __pyx_t_2 = PyNumber_Add(__pyx_v_prefix, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_v_prefix);
-    __pyx_v_prefix = __pyx_t_2;
+    __Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_2);
     __pyx_t_2 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":107
@@ -31317,11 +31338,9 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
     if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_XDECREF(__pyx_v_pattern);
-    __pyx_v_pattern = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_5);
     __pyx_t_5 = 0;
-    __Pyx_XDECREF(__pyx_v_val);
-    __pyx_v_val = __pyx_t_6;
+    __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_6);
     __pyx_t_6 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":251
@@ -31384,8 +31403,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
         }
         __Pyx_GOTREF(__pyx_t_5);
       }
-      __Pyx_XDECREF(__pyx_v_word_id);
-      __pyx_v_word_id = __pyx_t_5;
+      __Pyx_XDECREF_SET(__pyx_v_word_id, __pyx_t_5);
       __pyx_t_5 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":254
@@ -31418,8 +31436,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
  */
     if (!(likely(((__pyx_v_val) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_val, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_INCREF(__pyx_v_val);
-    __Pyx_XDECREF(((PyObject *)__pyx_v_arr));
-    __pyx_v_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_val);
+    __Pyx_XDECREF_SET(__pyx_v_arr, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_val));
 
     /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":257
  *                 fwrite(&(i), sizeof(int), 1, f)
@@ -31526,8 +31543,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
  *                 fread(&(word_id), sizeof(int), 1, f)
  */
     __Pyx_INCREF(((PyObject *)__pyx_empty_tuple));
-    __Pyx_XDECREF(((PyObject *)__pyx_v_key));
-    __pyx_v_key = __pyx_empty_tuple;
+    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_empty_tuple);
 
     /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":269
  *             fread(&(i), sizeof(int), 1, f)
@@ -31565,8 +31581,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
       __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_key), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_v_key));
-      __pyx_v_key = ((PyObject*)__pyx_t_1);
+      __Pyx_DECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_1));
       __pyx_t_1 = 0;
     }
 
@@ -31579,8 +31594,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
  */
     __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_XDECREF(((PyObject *)__pyx_v_arr));
-    __pyx_v_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
+    __Pyx_XDECREF_SET(__pyx_v_arr, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1));
     __pyx_t_1 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":273
@@ -32079,18 +32093,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
       {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L6_unpacking_done:;
     }
-    __Pyx_XDECREF(__pyx_v__);
-    __pyx_v__ = __pyx_t_7;
+    __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_7);
     __pyx_t_7 = 0;
-    __Pyx_DECREF(__pyx_v__);
-    __pyx_v__ = __pyx_t_8;
+    __Pyx_DECREF_SET(__pyx_v__, __pyx_t_8);
     __pyx_t_8 = 0;
-    __Pyx_XDECREF(__pyx_v_phrase);
-    __pyx_v_phrase = __pyx_t_9;
+    __Pyx_XDECREF_SET(__pyx_v_phrase, __pyx_t_9);
     __pyx_t_9 = 0;
     __Pyx_INCREF(__pyx_t_3);
-    __Pyx_XDECREF(__pyx_v_rank);
-    __pyx_v_rank = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_rank, __pyx_t_3);
     __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_3);
@@ -33090,8 +33100,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
       }
       __Pyx_GOTREF(__pyx_t_1);
     }
-    __Pyx_XDECREF(__pyx_v_pattern1);
-    __pyx_v_pattern1 = __pyx_t_1;
+    __Pyx_XDECREF_SET(__pyx_v_pattern1, __pyx_t_1);
     __pyx_t_1 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":391
@@ -33116,8 +33125,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
         }
         __Pyx_GOTREF(__pyx_t_9);
       }
-      __Pyx_XDECREF(__pyx_v_pattern2);
-      __pyx_v_pattern2 = __pyx_t_9;
+      __Pyx_XDECREF_SET(__pyx_v_pattern2, __pyx_t_9);
       __pyx_t_9 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":392
@@ -33144,8 +33152,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
         __pyx_t_8 = PyNumber_Add(__pyx_t_9, __pyx_v_pattern2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __Pyx_XDECREF(__pyx_v_combined_pattern);
-        __pyx_v_combined_pattern = __pyx_t_8;
+        __Pyx_XDECREF_SET(__pyx_v_combined_pattern, __pyx_t_8);
         __pyx_t_8 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":394
@@ -33186,8 +33193,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
       }
       __Pyx_GOTREF(__pyx_t_1);
     }
-    __Pyx_XDECREF(__pyx_v_pattern1);
-    __pyx_v_pattern1 = __pyx_t_1;
+    __Pyx_XDECREF_SET(__pyx_v_pattern1, __pyx_t_1);
     __pyx_t_1 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":397
@@ -33212,8 +33218,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
         }
         __Pyx_GOTREF(__pyx_t_8);
       }
-      __Pyx_XDECREF(__pyx_v_pattern2);
-      __pyx_v_pattern2 = __pyx_t_8;
+      __Pyx_XDECREF_SET(__pyx_v_pattern2, __pyx_t_8);
       __pyx_t_8 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":398
@@ -33225,8 +33230,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
  */
       __pyx_t_8 = PyNumber_Add(__pyx_v_x, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
-      __Pyx_DECREF(__pyx_v_x);
-      __pyx_v_x = __pyx_t_8;
+      __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_8);
       __pyx_t_8 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":399
@@ -33253,8 +33257,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
         __pyx_t_9 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __Pyx_XDECREF(__pyx_v_combined_pattern);
-        __pyx_v_combined_pattern = __pyx_t_9;
+        __Pyx_XDECREF_SET(__pyx_v_combined_pattern, __pyx_t_9);
         __pyx_t_9 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":401
@@ -33295,8 +33298,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
       }
       __Pyx_GOTREF(__pyx_t_1);
     }
-    __Pyx_XDECREF(__pyx_v_pattern1);
-    __pyx_v_pattern1 = __pyx_t_1;
+    __Pyx_XDECREF_SET(__pyx_v_pattern1, __pyx_t_1);
     __pyx_t_1 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":404
@@ -33321,8 +33323,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
         }
         __Pyx_GOTREF(__pyx_t_9);
       }
-      __Pyx_XDECREF(__pyx_v_pattern2);
-      __pyx_v_pattern2 = __pyx_t_9;
+      __Pyx_XDECREF_SET(__pyx_v_pattern2, __pyx_t_9);
       __pyx_t_9 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":405
@@ -33334,8 +33335,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
  */
       __pyx_t_9 = PyNumber_Add(__pyx_v_x, __pyx_int_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_v_x);
-      __pyx_v_x = __pyx_t_9;
+      __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_9);
       __pyx_t_9 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":406
@@ -33362,8 +33362,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
         __pyx_t_8 = PyNumber_Add(__pyx_t_9, __pyx_v_pattern2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __Pyx_XDECREF(__pyx_v_combined_pattern);
-        __pyx_v_combined_pattern = __pyx_t_8;
+        __Pyx_XDECREF_SET(__pyx_v_combined_pattern, __pyx_t_8);
         __pyx_t_8 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":408
@@ -33387,8 +33386,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
         __pyx_t_9 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_v_combined_pattern);
-        __pyx_v_combined_pattern = __pyx_t_9;
+        __Pyx_DECREF_SET(__pyx_v_combined_pattern, __pyx_t_9);
         __pyx_t_9 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":410
@@ -33478,11 +33476,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
     if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_XDECREF(__pyx_v_pattern);
-    __pyx_v_pattern = __pyx_t_1;
+    __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_1);
     __pyx_t_1 = 0;
-    __Pyx_XDECREF(__pyx_v_arr);
-    __pyx_v_arr = __pyx_t_9;
+    __Pyx_XDECREF_SET(__pyx_v_arr, __pyx_t_9);
     __pyx_t_9 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":416
@@ -33504,8 +33500,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
  *                     if word_id == -1:
  */
       __Pyx_INCREF(((PyObject *)__pyx_kp_s_47));
-      __Pyx_XDECREF(__pyx_v_s);
-      __pyx_v_s = ((PyObject *)__pyx_kp_s_47);
+      __Pyx_XDECREF_SET(__pyx_v_s, ((PyObject *)__pyx_kp_s_47));
 
       /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":418
  *             if pattern not in IJ_set:
@@ -33548,8 +33543,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
           }
           __Pyx_GOTREF(__pyx_t_1);
         }
-        __Pyx_XDECREF(__pyx_v_word_id);
-        __pyx_v_word_id = __pyx_t_1;
+        __Pyx_XDECREF_SET(__pyx_v_word_id, __pyx_t_1);
         __pyx_t_1 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":419
@@ -33573,8 +33567,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
  */
           __pyx_t_1 = PyNumber_Add(__pyx_v_s, ((PyObject *)__pyx_kp_s_85)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_1);
-          __Pyx_DECREF(__pyx_v_s);
-          __pyx_v_s = __pyx_t_1;
+          __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
           __pyx_t_1 = 0;
           goto __pyx_L56;
         }
@@ -33595,8 +33588,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
           __pyx_t_1 = PyNumber_Add(__pyx_t_8, ((PyObject *)__pyx_kp_s_69)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_1);
           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-          __Pyx_DECREF(__pyx_v_s);
-          __pyx_v_s = __pyx_t_1;
+          __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
           __pyx_t_1 = 0;
         }
         __pyx_L56:;
@@ -33640,8 +33632,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
  *                 arity = 0
  */
       __Pyx_INCREF(((PyObject *)__pyx_empty_tuple));
-      __Pyx_XDECREF(((PyObject *)__pyx_v_chunk));
-      __pyx_v_chunk = __pyx_empty_tuple;
+      __Pyx_XDECREF_SET(__pyx_v_chunk, __pyx_empty_tuple);
 
       /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":426
  *             else:
@@ -33660,8 +33651,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
  *                     if word_id == -1:
  */
       __Pyx_INCREF(__pyx_int_0);
-      __Pyx_XDECREF(__pyx_v_arity);
-      __pyx_v_arity = __pyx_int_0;
+      __Pyx_XDECREF_SET(__pyx_v_arity, __pyx_int_0);
 
       /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":428
  *                 max_rank = 0
@@ -33704,8 +33694,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
           }
           __Pyx_GOTREF(__pyx_t_9);
         }
-        __Pyx_XDECREF(__pyx_v_word_id);
-        __pyx_v_word_id = __pyx_t_9;
+        __Pyx_XDECREF_SET(__pyx_v_word_id, __pyx_t_9);
         __pyx_t_9 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":429
@@ -33759,8 +33748,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
  */
           __pyx_t_1 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_1);
-          __Pyx_DECREF(__pyx_v_arity);
-          __pyx_v_arity = __pyx_t_1;
+          __Pyx_DECREF_SET(__pyx_v_arity, __pyx_t_1);
           __pyx_t_1 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":432
@@ -33771,8 +33759,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
  *                         chunk = chunk + (word_id,)
  */
           __Pyx_INCREF(((PyObject *)__pyx_empty_tuple));
-          __Pyx_DECREF(((PyObject *)__pyx_v_chunk));
-          __pyx_v_chunk = __pyx_empty_tuple;
+          __Pyx_DECREF_SET(__pyx_v_chunk, __pyx_empty_tuple);
           goto __pyx_L59;
         }
         /*else*/ {
@@ -33792,8 +33779,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
           __pyx_t_9 = PyNumber_Add(((PyObject *)__pyx_v_chunk), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(((PyObject *)__pyx_t_9));
           __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-          __Pyx_DECREF(((PyObject *)__pyx_v_chunk));
-          __pyx_v_chunk = ((PyObject*)__pyx_t_9);
+          __Pyx_DECREF_SET(__pyx_v_chunk, ((PyObject*)__pyx_t_9));
           __pyx_t_9 = 0;
         }
         __pyx_L59:;
@@ -33912,8 +33898,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
     __pyx_t_7 = PyNumber_Add(__pyx_v_cumul_cost, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_v_cumul_cost);
-    __pyx_v_cumul_cost = __pyx_t_7;
+    __Pyx_DECREF_SET(__pyx_v_cumul_cost, __pyx_t_7);
     __pyx_t_7 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":443
@@ -33928,8 +33913,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
     __pyx_t_3 = PyNumber_Add(__pyx_v_cumul_count, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __Pyx_DECREF(__pyx_v_cumul_count);
-    __pyx_v_cumul_count = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_cumul_count, __pyx_t_3);
     __pyx_t_3 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":444
@@ -34015,8 +33999,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
       }
       __Pyx_GOTREF(__pyx_t_8);
     }
-    __Pyx_XDECREF(__pyx_v_pattern);
-    __pyx_v_pattern = __pyx_t_8;
+    __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_8);
     __pyx_t_8 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":448
@@ -36413,8 +36396,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_14write_enhanced(struct _
               }
               __Pyx_GOTREF(__pyx_t_1);
             }
-            __Pyx_XDECREF(__pyx_v_a_i);
-            __pyx_v_a_i = __pyx_t_1;
+            __Pyx_XDECREF_SET(__pyx_v_a_i, __pyx_t_1);
             __pyx_t_1 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":192
@@ -36496,8 +36478,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_14write_enhanced(struct _
               }
               __Pyx_GOTREF(__pyx_t_2);
             }
-            __Pyx_XDECREF(__pyx_v_w_i);
-            __pyx_v_w_i = __pyx_t_2;
+            __Pyx_XDECREF_SET(__pyx_v_w_i, __pyx_t_2);
             __pyx_t_2 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":195
@@ -40013,8 +39994,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
  */
       __pyx_t_1 = ((PyObject *)__pyx_v_phrase_location->arr);
       __Pyx_INCREF(__pyx_t_1);
-      __Pyx_DECREF(((PyObject *)__pyx_v_sample));
-      __pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
+      __Pyx_DECREF_SET(__pyx_v_sample, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1));
       __pyx_t_1 = 0;
       goto __pyx_L8;
     }
@@ -41935,8 +41915,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
       }
       __Pyx_GOTREF(__pyx_t_4);
     }
-    __Pyx_XDECREF(__pyx_v_word_id);
-    __pyx_v_word_id = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_word_id, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":450
@@ -41960,8 +41939,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
  */
       __pyx_t_4 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_v_arity);
-      __pyx_v_arity = __pyx_t_4;
+      __Pyx_DECREF_SET(__pyx_v_arity, __pyx_t_4);
       __pyx_t_4 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":452
@@ -42009,8 +41987,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
     __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_v_result));
-    __pyx_v_result = ((PyObject*)__pyx_t_4);
+    __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_4));
     __pyx_t_4 = 0;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -42166,8 +42143,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
       }
       __Pyx_GOTREF(__pyx_t_4);
     }
-    __Pyx_XDECREF(__pyx_v_word_id);
-    __pyx_v_word_id = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_word_id, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":465
@@ -42191,8 +42167,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
  */
       __pyx_t_4 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_v_arity);
-      __pyx_v_arity = __pyx_t_4;
+      __Pyx_DECREF_SET(__pyx_v_arity, __pyx_t_4);
       __pyx_t_4 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":467
@@ -42240,8 +42215,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
     __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_v_result));
-    __pyx_v_result = ((PyObject*)__pyx_t_4);
+    __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_4));
     __pyx_t_4 = 0;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -42715,11 +42689,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
         if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_XDECREF(__pyx_v_pattern);
-        __pyx_v_pattern = __pyx_t_4;
+        __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_4);
         __pyx_t_4 = 0;
-        __Pyx_XDECREF(__pyx_v_arr);
-        __pyx_v_arr = __pyx_t_5;
+        __Pyx_XDECREF_SET(__pyx_v_arr, __pyx_t_5);
         __pyx_t_5 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":495
@@ -42740,8 +42712,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-        __Pyx_XDECREF(__pyx_v_phrases);
-        __pyx_v_phrases = __pyx_t_3;
+        __Pyx_XDECREF_SET(__pyx_v_phrases, __pyx_t_3);
         __pyx_t_3 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":496
@@ -42785,8 +42756,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
             }
             __Pyx_GOTREF(__pyx_t_4);
           }
-          __Pyx_XDECREF(__pyx_v_phrase);
-          __pyx_v_phrase = __pyx_t_4;
+          __Pyx_XDECREF_SET(__pyx_v_phrase, __pyx_t_4);
           __pyx_t_4 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":497
@@ -42870,11 +42840,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
         if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __Pyx_GOTREF(__pyx_t_3);
-        __Pyx_XDECREF(__pyx_v_pattern);
-        __pyx_v_pattern = __pyx_t_4;
+        __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_4);
         __pyx_t_4 = 0;
-        __Pyx_XDECREF(__pyx_v_arr);
-        __pyx_v_arr = __pyx_t_3;
+        __Pyx_XDECREF_SET(__pyx_v_arr, __pyx_t_3);
         __pyx_t_3 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":501
@@ -42895,8 +42863,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
         __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-        __Pyx_XDECREF(__pyx_v_phrase);
-        __pyx_v_phrase = __pyx_t_5;
+        __Pyx_XDECREF_SET(__pyx_v_phrase, __pyx_t_5);
         __pyx_t_5 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":502
@@ -45750,8 +45717,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
  */
     __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_121)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_v_result);
-    __pyx_v_result = __pyx_t_2;
+    __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2);
     __pyx_t_2 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":855
@@ -45779,8 +45745,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
       __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 856; __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_v_result);
-      __pyx_v_result = __pyx_t_2;
+      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2);
       __pyx_t_2 = 0;
     }
 
@@ -45793,8 +45758,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
  */
     __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_v_result);
-    __pyx_v_result = __pyx_t_2;
+    __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2);
     __pyx_t_2 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":858
@@ -45816,8 +45780,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
  */
   __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_122)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_v_result);
-  __pyx_v_result = __pyx_t_2;
+  __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2);
   __pyx_t_2 = 0;
 
   /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":860
@@ -46002,8 +45965,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
       __pyx_t_3 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->intersect_helper(__pyx_v_self, __pyx_v_prefix, __pyx_v_suffix, __pyx_v_prefix_loc, __pyx_v_suffix_loc, __pyx_v_4cdec_2sa_3_sa_BAEZA_YATES); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(((PyObject *)__pyx_v_result));
-      __pyx_v_result = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3);
+      __Pyx_DECREF_SET(__pyx_v_result, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3));
       __pyx_t_3 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":878
@@ -46014,8 +45976,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
  *                 result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE)
  */
       __Pyx_INCREF(((PyObject *)__pyx_kp_s_124));
-      __Pyx_XDECREF(__pyx_v_intersect_method);
-      __pyx_v_intersect_method = ((PyObject *)__pyx_kp_s_124);
+      __Pyx_XDECREF_SET(__pyx_v_intersect_method, ((PyObject *)__pyx_kp_s_124));
       goto __pyx_L5;
     }
     /*else*/ {
@@ -46030,8 +45991,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
       __pyx_t_3 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->intersect_helper(__pyx_v_self, __pyx_v_prefix, __pyx_v_suffix, __pyx_v_prefix_loc, __pyx_v_suffix_loc, __pyx_v_4cdec_2sa_3_sa_MERGE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(((PyObject *)__pyx_v_result));
-      __pyx_v_result = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3);
+      __Pyx_DECREF_SET(__pyx_v_result, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3));
       __pyx_t_3 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":881
@@ -46042,8 +46002,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
  * 
  */
       __Pyx_INCREF(((PyObject *)__pyx_n_s__merge));
-      __Pyx_XDECREF(__pyx_v_intersect_method);
-      __pyx_v_intersect_method = ((PyObject *)__pyx_n_s__merge);
+      __Pyx_XDECREF_SET(__pyx_v_intersect_method, ((PyObject *)__pyx_n_s__merge));
     }
     __pyx_L5:;
     goto __pyx_L4;
@@ -46295,8 +46254,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
       {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L6_unpacking_done:;
     }
-    __Pyx_XDECREF(__pyx_v_toskip);
-    __pyx_v_toskip = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_toskip, __pyx_t_5);
     __pyx_t_5 = 0;
     if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
       PyObject* sequence = __pyx_t_6;
@@ -46356,14 +46314,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
       {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L8_unpacking_done:;
     }
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_7;
+    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_7);
     __pyx_t_7 = 0;
-    __Pyx_XDECREF(__pyx_v_alt);
-    __pyx_v_alt = __pyx_t_9;
+    __Pyx_XDECREF_SET(__pyx_v_alt, __pyx_t_9);
     __pyx_t_9 = 0;
-    __Pyx_XDECREF(__pyx_v_pathlen);
-    __pyx_v_pathlen = __pyx_t_10;
+    __Pyx_XDECREF_SET(__pyx_v_pathlen, __pyx_t_10);
     __pyx_t_10 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":888
@@ -46381,8 +46336,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
     __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_XDECREF(__pyx_v_spanlen);
-    __pyx_v_spanlen = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_spanlen, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":889
@@ -46432,8 +46386,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
  */
     __pyx_t_6 = PyNumber_Add(__pyx_v_i, __pyx_v_spanlen); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_XDECREF(__pyx_v_ni);
-    __pyx_v_ni = __pyx_t_6;
+    __Pyx_XDECREF_SET(__pyx_v_ni, __pyx_t_6);
     __pyx_t_6 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":892
@@ -46849,8 +46802,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
  */
     __pyx_t_1 = PyObject_GetItem(__pyx_v_reachable_buffer, ((PyObject *)__pyx_v_key)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_v_reachable);
-    __pyx_v_reachable = __pyx_t_1;
+    __Pyx_DECREF_SET(__pyx_v_reachable, __pyx_t_1);
     __pyx_t_1 = 0;
     goto __pyx_L4;
   }
@@ -46880,8 +46832,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_v_reachable);
-    __pyx_v_reachable = __pyx_t_2;
+    __Pyx_DECREF_SET(__pyx_v_reachable, __pyx_t_2);
     __pyx_t_2 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":911
@@ -46936,8 +46887,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
       }
       __Pyx_GOTREF(__pyx_t_4);
     }
-    __Pyx_XDECREF(__pyx_v_nextreachable);
-    __pyx_v_nextreachable = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_nextreachable, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":913
@@ -46984,8 +46934,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
         }
         __Pyx_GOTREF(__pyx_t_4);
       }
-      __Pyx_XDECREF(__pyx_v_next_id);
-      __pyx_v_next_id = __pyx_t_4;
+      __Pyx_XDECREF_SET(__pyx_v_next_id, __pyx_t_4);
       __pyx_t_4 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":914
@@ -47012,8 +46961,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
       __Pyx_GOTREF(__pyx_t_11);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-      __Pyx_XDECREF(__pyx_v_jump);
-      __pyx_v_jump = __pyx_t_11;
+      __Pyx_XDECREF_SET(__pyx_v_jump, __pyx_t_11);
       __pyx_t_11 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":915
@@ -47114,8 +47062,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
             }
             __Pyx_GOTREF(__pyx_t_4);
           }
-          __Pyx_XDECREF(__pyx_v_alt_id);
-          __pyx_v_alt_id = __pyx_t_4;
+          __Pyx_XDECREF_SET(__pyx_v_alt_id, __pyx_t_4);
           __pyx_t_4 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":919
@@ -47162,8 +47109,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
             PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_14);
             __Pyx_GIVEREF(__pyx_t_14);
             __pyx_t_14 = 0;
-            __Pyx_XDECREF(((PyObject *)__pyx_v_newel));
-            __pyx_v_newel = ((PyObject*)__pyx_t_11);
+            __Pyx_XDECREF_SET(__pyx_v_newel, ((PyObject*)__pyx_t_11));
             __pyx_t_11 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":921
@@ -47451,8 +47397,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
       }
       __Pyx_GOTREF(__pyx_t_3);
     }
-    __Pyx_XDECREF(__pyx_v_alt_id);
-    __pyx_v_alt_id = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_alt_id, __pyx_t_3);
     __pyx_t_3 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":930
@@ -47640,8 +47585,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
             }
             __Pyx_GOTREF(__pyx_t_3);
           }
-          __Pyx_XDECREF(__pyx_v_ifromchild);
-          __pyx_v_ifromchild = __pyx_t_3;
+          __Pyx_XDECREF_SET(__pyx_v_ifromchild, __pyx_t_3);
           __pyx_t_3 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":938
@@ -47912,8 +47856,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    __Pyx_XDECREF(__pyx_v_currmin);
-    __pyx_v_currmin = __pyx_t_6;
+    __Pyx_XDECREF_SET(__pyx_v_currmin, __pyx_t_6);
     __pyx_t_6 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":952
@@ -47949,8 +47892,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
  */
       __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_currmin, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_v_currmin);
-      __pyx_v_currmin = __pyx_t_1;
+      __Pyx_DECREF_SET(__pyx_v_currmin, __pyx_t_1);
       __pyx_t_1 = 0;
       goto __pyx_L7;
     }
@@ -47976,8 +47918,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
  * 
  */
       __Pyx_INCREF(__pyx_v_currmin);
-      __Pyx_DECREF(__pyx_v_min);
-      __pyx_v_min = __pyx_v_currmin;
+      __Pyx_DECREF_SET(__pyx_v_min, __pyx_v_currmin);
       goto __pyx_L8;
     }
     __pyx_L8:;
@@ -48171,8 +48112,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
  */
     __pyx_t_2 = __Pyx_PyObject_Pop(((PyObject *)__pyx_v_candidate)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_XDECREF(__pyx_v_curr);
-    __pyx_v_curr = __pyx_t_2;
+    __Pyx_XDECREF_SET(__pyx_v_curr, __pyx_t_2);
     __pyx_t_2 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":964
@@ -48264,8 +48204,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
     __pyx_t_5 = PyObject_GetItem(__pyx_v__columns, __pyx_t_1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_XDECREF(__pyx_v_curr_col);
-    __pyx_v_curr_col = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_curr_col, __pyx_t_5);
     __pyx_t_5 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":969
@@ -48309,8 +48248,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
         }
         __Pyx_GOTREF(__pyx_t_1);
       }
-      __Pyx_XDECREF(__pyx_v_alt);
-      __pyx_v_alt = __pyx_t_1;
+      __Pyx_XDECREF_SET(__pyx_v_alt, __pyx_t_1);
       __pyx_t_1 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":970
@@ -48328,8 +48266,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
       __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_XDECREF(__pyx_v_next_id);
-      __pyx_v_next_id = __pyx_t_10;
+      __Pyx_XDECREF_SET(__pyx_v_next_id, __pyx_t_10);
       __pyx_t_10 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":971
@@ -48340,8 +48277,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
  *                     jump = 0
  */
       __Pyx_INCREF(__pyx_int_1);
-      __Pyx_XDECREF(__pyx_v_jump);
-      __pyx_v_jump = __pyx_int_1;
+      __Pyx_XDECREF_SET(__pyx_v_jump, __pyx_int_1);
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":972
  *                 next_id = curr[0]+alt[2]
@@ -48369,8 +48305,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
  *                     candidate.append([next_id,curr[1]+jump])
  */
         __Pyx_INCREF(__pyx_int_0);
-        __Pyx_DECREF(__pyx_v_jump);
-        __pyx_v_jump = __pyx_int_0;
+        __Pyx_DECREF_SET(__pyx_v_jump, __pyx_int_0);
         goto __pyx_L9;
       }
       __pyx_L9:;
@@ -48829,9 +48764,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_4gener
       __Pyx_GOTREF(__pyx_t_4);
     }
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_word, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_cur_scope->__pyx_v_word = __pyx_t_4;
     __pyx_t_4 = 0;
     __pyx_t_4 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_word, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
@@ -49263,9 +49197,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
     __Pyx_GOTREF(__pyx_t_12);
     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_xroot);
-    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_xroot);
+    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_xroot, __pyx_t_12);
     __Pyx_GIVEREF(__pyx_t_12);
-    __pyx_cur_scope->__pyx_v_xroot = __pyx_t_12;
     __pyx_t_12 = 0;
     goto __pyx_L9;
   }
@@ -49289,9 +49222,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
     __Pyx_GOTREF(__pyx_t_11);
     __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_xroot);
-    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_xroot);
+    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_xroot, __pyx_t_11);
     __Pyx_GIVEREF(__pyx_t_11);
-    __pyx_cur_scope->__pyx_v_xroot = __pyx_t_11;
     __pyx_t_11 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1017
@@ -49506,9 +49438,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
     __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_15);
     __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier));
-    __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier));
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject*)__pyx_t_15));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_15));
-    __pyx_cur_scope->__pyx_v_new_frontier = ((PyObject*)__pyx_t_15);
     __pyx_t_15 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1030
@@ -49609,30 +49540,25 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
       __pyx_cur_scope->__pyx_v_k = __pyx_t_5;
       __pyx_cur_scope->__pyx_v_i = __pyx_t_7;
       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_input_match);
-      __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_input_match);
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_input_match, __pyx_t_11);
       __Pyx_GIVEREF(__pyx_t_11);
-      __pyx_cur_scope->__pyx_v_input_match = __pyx_t_11;
       __pyx_t_11 = 0;
       __pyx_cur_scope->__pyx_v_alt = __pyx_t_21;
       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pathlen);
-      __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_pathlen);
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pathlen, __pyx_t_12);
       __Pyx_GIVEREF(__pyx_t_12);
-      __pyx_cur_scope->__pyx_v_pathlen = __pyx_t_12;
       __pyx_t_12 = 0;
       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_node);
-      __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_node);
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_node, __pyx_t_1);
       __Pyx_GIVEREF(__pyx_t_1);
-      __pyx_cur_scope->__pyx_v_node = __pyx_t_1;
       __pyx_t_1 = 0;
       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_prefix);
-      __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_prefix);
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_prefix, __pyx_t_17);
       __Pyx_GIVEREF(__pyx_t_17);
-      __pyx_cur_scope->__pyx_v_prefix = __pyx_t_17;
       __pyx_t_17 = 0;
       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_is_shadow_path);
-      __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_is_shadow_path);
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_is_shadow_path, __pyx_t_18);
       __Pyx_GIVEREF(__pyx_t_18);
-      __pyx_cur_scope->__pyx_v_is_shadow_path = __pyx_t_18;
       __pyx_t_18 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1031
@@ -49651,9 +49577,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word_id);
-      __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word_id);
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_3);
       __Pyx_GIVEREF(__pyx_t_3);
-      __pyx_cur_scope->__pyx_v_word_id = __pyx_t_3;
       __pyx_t_3 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1032
@@ -49672,9 +49597,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_spanlen);
-      __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_spanlen);
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_spanlen, __pyx_t_3);
       __Pyx_GIVEREF(__pyx_t_3);
-      __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_3;
       __pyx_t_3 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1034
@@ -49823,9 +49747,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
       __Pyx_GOTREF(__pyx_t_18);
       __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_phrase);
-      __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_phrase);
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_phrase, __pyx_t_18);
       __Pyx_GIVEREF(__pyx_t_18);
-      __pyx_cur_scope->__pyx_v_phrase = __pyx_t_18;
       __pyx_t_18 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1043
@@ -49844,9 +49767,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
       __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase));
-      __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase));
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_hiero_phrase, ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1));
       __Pyx_GIVEREF(__pyx_t_1);
-      __pyx_cur_scope->__pyx_v_hiero_phrase = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1);
       __pyx_t_1 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1044
@@ -49930,9 +49852,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __Pyx_GOTREF(__pyx_t_18);
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
           __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node);
-          __Pyx_DECREF(__pyx_cur_scope->__pyx_v_node);
+          __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_node, __pyx_t_18);
           __Pyx_GIVEREF(__pyx_t_18);
-          __pyx_cur_scope->__pyx_v_node = __pyx_t_18;
           __pyx_t_18 = 0;
         }
         __pyx_L28:;
@@ -50079,9 +50000,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
  */
         __Pyx_INCREF(Py_None);
         __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_new_node);
-        __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_new_node);
+        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_new_node, Py_None);
         __Pyx_GIVEREF(Py_None);
-        __pyx_cur_scope->__pyx_v_new_node = Py_None;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1073
  *                 if lookup_required:
@@ -50146,9 +50066,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __Pyx_GOTREF(__pyx_t_3);
           __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
           __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node);
-          __Pyx_DECREF(__pyx_cur_scope->__pyx_v_new_node);
+          __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_new_node, __pyx_t_3);
           __Pyx_GIVEREF(__pyx_t_3);
-          __pyx_cur_scope->__pyx_v_new_node = __pyx_t_3;
           __pyx_t_3 = 0;
           goto __pyx_L33;
         }
@@ -50177,9 +50096,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __Pyx_GOTREF(__pyx_t_1);
             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
             __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_intersect_start_time);
-            __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_intersect_start_time);
+            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_intersect_start_time, __pyx_t_1);
             __Pyx_GIVEREF(__pyx_t_1);
-            __pyx_cur_scope->__pyx_v_intersect_start_time = __pyx_t_1;
             __pyx_t_1 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1083
@@ -50201,9 +50119,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __Pyx_GOTREF(__pyx_t_3);
             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
             __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location));
-            __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location));
+            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_phrase_location, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3));
             __Pyx_GIVEREF(__pyx_t_3);
-            __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3);
             __pyx_t_3 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1084
@@ -50219,9 +50136,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __Pyx_GOTREF(__pyx_t_1);
             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
             __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_intersect_stop_time);
-            __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_intersect_stop_time);
+            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_intersect_stop_time, __pyx_t_1);
             __Pyx_GIVEREF(__pyx_t_1);
-            __pyx_cur_scope->__pyx_v_intersect_stop_time = __pyx_t_1;
             __pyx_t_1 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1085
@@ -50257,9 +50173,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __Pyx_GOTREF(__pyx_t_18);
             if (!(likely(((__pyx_t_18) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_18, __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location));
-            __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location));
+            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_phrase_location, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_18));
             __Pyx_GIVEREF(__pyx_t_18);
-            __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_18);
             __pyx_t_18 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1089
@@ -50303,9 +50218,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
             __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
             __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sa_range);
-            __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sa_range);
+            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_sa_range, __pyx_t_12);
             __Pyx_GIVEREF(__pyx_t_12);
-            __pyx_cur_scope->__pyx_v_sa_range = __pyx_t_12;
             __pyx_t_12 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1090
@@ -50340,9 +50254,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
               __Pyx_GOTREF(__pyx_t_10);
               __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
               __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location));
-              __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location));
+              __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_phrase_location, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_10));
               __Pyx_GIVEREF(__pyx_t_10);
-              __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_10);
               __pyx_t_10 = 0;
               goto __pyx_L35;
             }
@@ -50357,9 +50270,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
  */
               __Pyx_INCREF(Py_None);
               __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location));
-              __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location));
+              __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_phrase_location, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)Py_None));
               __Pyx_GIVEREF(Py_None);
-              __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)Py_None);
             }
             __pyx_L35:;
           }
@@ -50410,9 +50322,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __pyx_t_10 = __pyx_cur_scope->__pyx_v_self->rules->root;
           __Pyx_INCREF(__pyx_t_10);
           __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_suffix_link);
-          __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_suffix_link);
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_suffix_link, __pyx_t_10);
           __Pyx_GIVEREF(__pyx_t_10);
-          __pyx_cur_scope->__pyx_v_suffix_link = __pyx_t_10;
           __pyx_t_10 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1101
@@ -50445,9 +50356,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __Pyx_GOTREF(__pyx_t_10);
             __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
             __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_suffix_link);
-            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_suffix_link);
+            __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_suffix_link, __pyx_t_10);
             __Pyx_GIVEREF(__pyx_t_10);
-            __pyx_cur_scope->__pyx_v_suffix_link = __pyx_t_10;
             __pyx_t_10 = 0;
             goto __pyx_L37;
           }
@@ -50485,9 +50395,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __Pyx_GOTREF(__pyx_t_12);
           __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
           __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node);
-          __Pyx_DECREF(__pyx_cur_scope->__pyx_v_new_node);
+          __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_new_node, __pyx_t_12);
           __Pyx_GIVEREF(__pyx_t_12);
-          __pyx_cur_scope->__pyx_v_new_node = __pyx_t_12;
           __pyx_t_12 = 0;
         }
         __pyx_L33:;
@@ -50513,9 +50422,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
  */
         __Pyx_INCREF(__pyx_cur_scope->__pyx_v_new_node);
         __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node);
-        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_node);
+        __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_node, __pyx_cur_scope->__pyx_v_new_node);
         __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new_node);
-        __pyx_cur_scope->__pyx_v_node = __pyx_cur_scope->__pyx_v_new_node;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1112
  *                     This should happen before we get to extraction (so that
@@ -50537,9 +50445,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __pyx_t_12 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_arity + 1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_12);
           __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_xcat_index);
-          __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_xcat_index);
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_xcat_index, __pyx_t_12);
           __Pyx_GIVEREF(__pyx_t_12);
-          __pyx_cur_scope->__pyx_v_xcat_index = __pyx_t_12;
           __pyx_t_12 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1114
@@ -50561,9 +50468,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
  */
           __Pyx_INCREF(__pyx_cur_scope->__pyx_v_xcat_index);
           __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index);
-          __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index);
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index, __pyx_cur_scope->__pyx_v_xcat_index);
           __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xcat_index);
-          __pyx_cur_scope->__pyx_v_suffix_link_xcat_index = __pyx_cur_scope->__pyx_v_xcat_index;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1116
  *                         xcat = sym_setindex(self.category, xcat_index)
@@ -50585,9 +50491,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __pyx_t_12 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_xcat_index, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(__pyx_t_12);
             __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index);
-            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index);
+            __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index, __pyx_t_12);
             __Pyx_GIVEREF(__pyx_t_12);
-            __pyx_cur_scope->__pyx_v_suffix_link_xcat_index = __pyx_t_12;
             __pyx_t_12 = 0;
             goto __pyx_L39;
           }
@@ -50715,9 +50620,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
           if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_sample));
-          __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_sample));
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_sample, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12));
           __Pyx_GIVEREF(__pyx_t_12);
-          __pyx_cur_scope->__pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12);
           __pyx_t_12 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1126
@@ -50750,9 +50654,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __Pyx_GOTREF(__pyx_t_18);
           __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
           __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_chunklen));
-          __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_chunklen));
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_chunklen, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_18));
           __Pyx_GIVEREF(__pyx_t_18);
-          __pyx_cur_scope->__pyx_v_chunklen = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_18);
           __pyx_t_18 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1128
@@ -50785,9 +50688,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_18);
           __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_extracts));
-          __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_extracts));
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_extracts, ((PyObject*)__pyx_t_18));
           __Pyx_GIVEREF(((PyObject *)__pyx_t_18));
-          __pyx_cur_scope->__pyx_v_extracts = ((PyObject*)__pyx_t_18);
           __pyx_t_18 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1131
@@ -50812,9 +50714,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __Pyx_GOTREF(__pyx_t_12);
           __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
           __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract_start);
-          __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract_start);
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_extract_start, __pyx_t_12);
           __Pyx_GIVEREF(__pyx_t_12);
-          __pyx_cur_scope->__pyx_v_extract_start = __pyx_t_12;
           __pyx_t_12 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1133
@@ -50838,9 +50739,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(__pyx_t_12);
             __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract);
-            __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract);
+            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_extract, ((PyObject *)__pyx_t_12));
             __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
-            __pyx_cur_scope->__pyx_v_extract = ((PyObject *)__pyx_t_12);
             __pyx_t_12 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1136
@@ -50870,9 +50770,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __Pyx_GOTREF(__pyx_t_12);
             __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
             __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_loc);
-            __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_loc);
+            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_loc, __pyx_t_12);
             __Pyx_GIVEREF(__pyx_t_12);
-            __pyx_cur_scope->__pyx_v_loc = __pyx_t_12;
             __pyx_t_12 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1138
@@ -50885,9 +50784,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __pyx_t_12 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->extract(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_hiero_phrase, (&__pyx_cur_scope->__pyx_v_matching), __pyx_cur_scope->__pyx_v_chunklen->arr, __pyx_cur_scope->__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(__pyx_t_12);
             __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_extract);
-            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_extract);
+            __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_extract, __pyx_t_12);
             __Pyx_GIVEREF(__pyx_t_12);
-            __pyx_cur_scope->__pyx_v_extract = __pyx_t_12;
             __pyx_t_12 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1139
@@ -50936,9 +50834,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
                 __Pyx_GOTREF(__pyx_t_17);
               }
               __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
-              __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e);
+              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_17);
               __Pyx_GIVEREF(__pyx_t_17);
-              __pyx_cur_scope->__pyx_v_e = __pyx_t_17;
               __pyx_t_17 = 0;
               __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               __Pyx_GOTREF(__pyx_t_17);
@@ -51015,9 +50912,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __Pyx_GOTREF(__pyx_t_10);
           __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
           __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract_stop);
-          __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract_stop);
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_extract_stop, __pyx_t_10);
           __Pyx_GIVEREF(__pyx_t_10);
-          __pyx_cur_scope->__pyx_v_extract_stop = __pyx_t_10;
           __pyx_t_10 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1144
@@ -51063,9 +50959,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __Pyx_GOTREF(__pyx_t_18);
             __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
             __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_fcount);
-            __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_fcount);
+            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_18);
             __Pyx_GIVEREF(__pyx_t_18);
-            __pyx_cur_scope->__pyx_v_fcount = __pyx_t_18;
             __pyx_t_18 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1147
@@ -51089,9 +50984,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
             __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
             __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_fphrases);
-            __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_fphrases);
+            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_fphrases, __pyx_t_10);
             __Pyx_GIVEREF(__pyx_t_10);
-            __pyx_cur_scope->__pyx_v_fphrases = __pyx_t_10;
             __pyx_t_10 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1148
@@ -51223,29 +51117,24 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
                 __pyx_L53_unpacking_done:;
               }
               __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f);
-              __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_f);
+              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_f, __pyx_t_1);
               __Pyx_GIVEREF(__pyx_t_1);
-              __pyx_cur_scope->__pyx_v_f = __pyx_t_1;
               __pyx_t_1 = 0;
               __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
-              __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e);
+              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_3);
               __Pyx_GIVEREF(__pyx_t_3);
-              __pyx_cur_scope->__pyx_v_e = __pyx_t_3;
               __pyx_t_3 = 0;
               __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_count);
-              __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_count);
+              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_count, __pyx_t_11);
               __Pyx_GIVEREF(__pyx_t_11);
-              __pyx_cur_scope->__pyx_v_count = __pyx_t_11;
               __pyx_t_11 = 0;
               __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_als);
-              __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_als);
+              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_als, __pyx_t_8);
               __Pyx_GIVEREF(__pyx_t_8);
-              __pyx_cur_scope->__pyx_v_als = __pyx_t_8;
               __pyx_t_8 = 0;
               __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_loc);
-              __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_loc);
+              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_loc, __pyx_t_17);
               __Pyx_GIVEREF(__pyx_t_17);
-              __pyx_cur_scope->__pyx_v_loc = __pyx_t_17;
               __pyx_t_17 = 0;
 
               /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1149
@@ -51312,14 +51201,12 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
               __Pyx_GOTREF(__pyx_t_18);
               __Pyx_GOTREF(__pyx_t_12);
               __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f);
-              __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_f);
+              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_f, __pyx_t_18);
               __Pyx_GIVEREF(__pyx_t_18);
-              __pyx_cur_scope->__pyx_v_f = __pyx_t_18;
               __pyx_t_18 = 0;
               __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elist);
-              __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_elist);
+              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elist, __pyx_t_12);
               __Pyx_GIVEREF(__pyx_t_12);
-              __pyx_cur_scope->__pyx_v_elist = __pyx_t_12;
               __pyx_t_12 = 0;
 
               /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1152
@@ -51346,14 +51233,12 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
                 __Pyx_GOTREF(__pyx_t_18);
                 __Pyx_GOTREF(__pyx_t_17);
                 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
-                __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e);
+                __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_18);
                 __Pyx_GIVEREF(__pyx_t_18);
-                __pyx_cur_scope->__pyx_v_e = __pyx_t_18;
                 __pyx_t_18 = 0;
                 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alslist);
-                __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alslist);
+                __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_alslist, __pyx_t_17);
                 __Pyx_GIVEREF(__pyx_t_17);
-                __pyx_cur_scope->__pyx_v_alslist = __pyx_t_17;
                 __pyx_t_17 = 0;
 
                 /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1153
@@ -51435,14 +51320,12 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
                   __pyx_L59_unpacking_done:;
                 }
                 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alignment);
-                __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alignment);
+                __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_alignment, __pyx_t_18);
                 __Pyx_GIVEREF(__pyx_t_18);
-                __pyx_cur_scope->__pyx_v_alignment = __pyx_t_18;
                 __pyx_t_18 = 0;
                 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_max_locs);
-                __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_max_locs);
+                __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_max_locs, __pyx_t_17);
                 __Pyx_GIVEREF(__pyx_t_17);
-                __pyx_cur_scope->__pyx_v_max_locs = __pyx_t_17;
                 __pyx_t_17 = 0;
 
                 /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1154
@@ -51483,9 +51366,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
                 __Pyx_GOTREF(__pyx_t_18);
                 __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0;
                 __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_locs));
-                __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_locs));
+                __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_locs, ((PyObject*)__pyx_t_18));
                 __Pyx_GIVEREF(__pyx_t_18);
-                __pyx_cur_scope->__pyx_v_locs = ((PyObject*)__pyx_t_18);
                 __pyx_t_18 = 0;
 
                 /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1155
@@ -51499,9 +51381,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
                 __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_26); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                 __Pyx_GOTREF(__pyx_t_18);
                 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_count);
-                __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_count);
+                __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_count, __pyx_t_18);
                 __Pyx_GIVEREF(__pyx_t_18);
-                __pyx_cur_scope->__pyx_v_count = __pyx_t_18;
                 __pyx_t_18 = 0;
 
                 /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1156
@@ -51622,9 +51503,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
                 __Pyx_GOTREF(__pyx_t_11);
                 __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
                 __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores));
-                __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores));
+                __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_scores, ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_11));
                 __Pyx_GIVEREF(__pyx_t_11);
-                __pyx_cur_scope->__pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_11);
                 __pyx_t_11 = 0;
 
                 /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1164
@@ -51930,9 +51810,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __Pyx_GOTREF(__pyx_t_16);
           __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
           __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_xnode);
-          __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_xnode);
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_xnode, __pyx_t_16);
           __Pyx_GIVEREF(__pyx_t_16);
-          __pyx_cur_scope->__pyx_v_xnode = __pyx_t_16;
           __pyx_t_16 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1178
@@ -51964,9 +51843,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __Pyx_GOTREF(((PyObject *)__pyx_t_18));
           __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
           __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_key));
-          __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_key));
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, ((PyObject*)__pyx_t_18));
           __Pyx_GIVEREF(((PyObject *)__pyx_t_18));
-          __pyx_cur_scope->__pyx_v_key = ((PyObject*)__pyx_t_18);
           __pyx_t_18 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1179
@@ -51979,9 +51857,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_18);
           __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes);
-          __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_frontier_nodes);
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_frontier_nodes, ((PyObject *)__pyx_t_18));
           __Pyx_GIVEREF(((PyObject *)__pyx_t_18));
-          __pyx_cur_scope->__pyx_v_frontier_nodes = ((PyObject *)__pyx_t_18);
           __pyx_t_18 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1180
@@ -52005,9 +51882,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __pyx_t_18 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key)); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(__pyx_t_18);
             __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes);
-            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_frontier_nodes);
+            __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_frontier_nodes, __pyx_t_18);
             __Pyx_GIVEREF(__pyx_t_18);
-            __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_18;
             __pyx_t_18 = 0;
             goto __pyx_L67;
           }
@@ -52054,9 +51930,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
             __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
             __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes);
-            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_frontier_nodes);
+            __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_frontier_nodes, __pyx_t_16);
             __Pyx_GIVEREF(__pyx_t_16);
-            __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_16;
             __pyx_t_16 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1184
@@ -52176,9 +52051,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
             __pyx_cur_scope->__pyx_v_i = __pyx_t_21;
             __pyx_cur_scope->__pyx_v_alt = __pyx_t_7;
             __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_pathlen);
-            __Pyx_DECREF(__pyx_cur_scope->__pyx_v_pathlen);
+            __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pathlen, __pyx_t_12);
             __Pyx_GIVEREF(__pyx_t_12);
-            __pyx_cur_scope->__pyx_v_pathlen = __pyx_t_12;
             __pyx_t_12 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1187
@@ -52263,9 +52137,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
  */
     __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier));
     __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_frontier));
-    __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_frontier));
+    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_frontier, __pyx_cur_scope->__pyx_v_new_frontier);
     __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier));
-    __pyx_cur_scope->__pyx_v_frontier = __pyx_cur_scope->__pyx_v_new_frontier;
   }
 
   /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1191
@@ -52424,19 +52297,16 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
         __pyx_L76_unpacking_done:;
       }
       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f);
-      __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_f);
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_f, __pyx_t_15);
       __Pyx_GIVEREF(__pyx_t_15);
-      __pyx_cur_scope->__pyx_v_f = __pyx_t_15;
       __pyx_t_15 = 0;
       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_lex_i);
-      __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_lex_i);
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_lex_i, __pyx_t_3);
       __Pyx_GIVEREF(__pyx_t_3);
-      __pyx_cur_scope->__pyx_v_lex_i = __pyx_t_3;
       __pyx_t_3 = 0;
       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_lex_j);
-      __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_lex_j);
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_lex_j, __pyx_t_18);
       __Pyx_GIVEREF(__pyx_t_18);
-      __pyx_cur_scope->__pyx_v_lex_j = __pyx_t_18;
       __pyx_t_18 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1195
@@ -52452,9 +52322,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
       __Pyx_GOTREF(__pyx_t_18);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_spanlen);
-      __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_spanlen);
+      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_spanlen, __pyx_t_18);
       __Pyx_GIVEREF(__pyx_t_18);
-      __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_18;
       __pyx_t_18 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1196
@@ -52481,9 +52350,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
         __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_spanlen, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
         __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_spanlen);
-        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_spanlen);
+        __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_spanlen, __pyx_t_18);
         __Pyx_GIVEREF(__pyx_t_18);
-        __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_18;
         __pyx_t_18 = 0;
         goto __pyx_L77;
       }
@@ -52513,9 +52381,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
         __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_spanlen, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
         __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_spanlen);
-        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_spanlen);
+        __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_spanlen, __pyx_t_18);
         __Pyx_GIVEREF(__pyx_t_18);
-        __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_18;
         __pyx_t_18 = 0;
         goto __pyx_L78;
       }
@@ -52581,9 +52448,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __Pyx_GOTREF(__pyx_t_3);
         }
         __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
-        __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e);
+        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_3);
         __Pyx_GIVEREF(__pyx_t_3);
-        __pyx_cur_scope->__pyx_v_e = __pyx_t_3;
         __pyx_t_3 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1201
@@ -52707,9 +52573,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __Pyx_GOTREF(__pyx_t_15);
           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
           __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores));
-          __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores));
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_scores, ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_15));
           __Pyx_GIVEREF(__pyx_t_15);
-          __pyx_cur_scope->__pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_15);
           __pyx_t_15 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1210
@@ -52728,9 +52593,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
           __Pyx_GOTREF(__pyx_t_15);
           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
           __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alignment);
-          __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alignment);
+          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_alignment, __pyx_t_15);
           __Pyx_GIVEREF(__pyx_t_15);
-          __pyx_cur_scope->__pyx_v_alignment = __pyx_t_15;
           __pyx_t_15 = 0;
 
           /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1211
@@ -54847,8 +54711,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
  */
     __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_XDECREF(((PyObject *)__pyx_v_indexes));
-    __pyx_v_indexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
+    __Pyx_XDECREF_SET(__pyx_v_indexes, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1));
     __pyx_t_1 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1454
@@ -55144,8 +55007,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_f_4cdec_2sa_3_sa_23HieroCa
  *                 if sent_links[idx] == s:
  */
     __Pyx_INCREF(__pyx_int_0);
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_int_0;
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_int_0);
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1479
  *             if s < 0: continue
@@ -55198,8 +55060,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_f_4cdec_2sa_3_sa_23HieroCa
         __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-        __Pyx_XDECREF(__pyx_v_j);
-        __pyx_v_j = __pyx_t_1;
+        __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_1);
         __pyx_t_1 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1482
@@ -55231,8 +55092,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_f_4cdec_2sa_3_sa_23HieroCa
  */
       __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_idx, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_v_idx);
-      __pyx_v_idx = __pyx_t_1;
+      __Pyx_DECREF_SET(__pyx_v_idx, __pyx_t_1);
       __pyx_t_1 = 0;
     }
     __pyx_L3_continue:;
@@ -55527,8 +55387,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
  */
       __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_sofar, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_v_sofar);
-      __pyx_v_sofar = __pyx_t_1;
+      __Pyx_DECREF_SET(__pyx_v_sofar, __pyx_t_1);
       __pyx_t_1 = 0;
     }
 
@@ -55565,8 +55424,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
  */
       __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_sofar, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_v_sofar);
-      __pyx_v_sofar = __pyx_t_3;
+      __Pyx_DECREF_SET(__pyx_v_sofar, __pyx_t_3);
       __pyx_t_3 = 0;
       goto __pyx_L7;
     }
@@ -55951,8 +55809,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
     __Pyx_GIVEREF(__pyx_t_1);
     __pyx_t_3 = 0;
     __pyx_t_1 = 0;
-    __Pyx_XDECREF(((PyObject *)__pyx_v_al));
-    __pyx_v_al = ((PyObject*)__pyx_t_10);
+    __Pyx_XDECREF_SET(__pyx_v_al, ((PyObject*)__pyx_t_10));
     __pyx_t_10 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1565
@@ -56065,8 +55922,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
  *             if self.require_aligned_chunks and num_aligned_chunks < num_chunks:
  */
       __Pyx_INCREF(((PyObject *)__pyx_kp_s_133));
-      __Pyx_DECREF(__pyx_v_reason_for_failure);
-      __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_133);
+      __Pyx_DECREF_SET(__pyx_v_reason_for_failure, ((PyObject *)__pyx_kp_s_133));
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1577
  *             if num_aligned_chunks == 0:
@@ -56103,8 +55959,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
  * 
  */
       __Pyx_INCREF(((PyObject *)__pyx_kp_s_134));
-      __Pyx_DECREF(__pyx_v_reason_for_failure);
-      __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_134);
+      __Pyx_DECREF_SET(__pyx_v_reason_for_failure, ((PyObject *)__pyx_kp_s_134));
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1580
  *             if self.require_aligned_chunks and num_aligned_chunks < num_chunks:
@@ -56164,8 +56019,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
  *                     break
  */
         __Pyx_INCREF(((PyObject *)__pyx_kp_s_135));
-        __Pyx_DECREF(__pyx_v_reason_for_failure);
-        __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_135);
+        __Pyx_DECREF_SET(__pyx_v_reason_for_failure, ((PyObject *)__pyx_kp_s_135));
 
         /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1587
  *                 if f_links_low[matching.arr[matching.start+i]+chunklen[i]-f_sent_start] == -1:
@@ -56206,8 +56060,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
  *                     break
  */
         __Pyx_INCREF(((PyObject *)__pyx_kp_s_135));
-        __Pyx_DECREF(__pyx_v_reason_for_failure);
-        __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_135);
+        __Pyx_DECREF_SET(__pyx_v_reason_for_failure, ((PyObject *)__pyx_kp_s_135));
 
         /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1591
  *                 if f_links_low[matching.arr[matching.start+i+1]-1-f_sent_start] == -1:
@@ -56422,8 +56275,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
  *                     gap_start = 1
  */
             __Pyx_INCREF(((PyObject *)__pyx_kp_s_136));
-            __Pyx_DECREF(__pyx_v_reason_for_failure);
-            __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_136);
+            __Pyx_DECREF_SET(__pyx_v_reason_for_failure, ((PyObject *)__pyx_kp_s_136));
             goto __pyx_L38;
           }
           __pyx_L38:;
@@ -56621,8 +56473,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
  *                     if self.tight_phrases and f_links_low[f_high-1] == -1:
  */
             __Pyx_INCREF(((PyObject *)__pyx_kp_s_137));
-            __Pyx_DECREF(__pyx_v_reason_for_failure);
-            __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_137);
+            __Pyx_DECREF_SET(__pyx_v_reason_for_failure, ((PyObject *)__pyx_kp_s_137));
             goto __pyx_L45;
           }
           __pyx_L45:;
@@ -56743,8 +56594,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
             __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_138), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(((PyObject *)__pyx_t_1));
             __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-            __Pyx_DECREF(__pyx_v_reason_for_failure);
-            __pyx_v_reason_for_failure = ((PyObject *)__pyx_t_1);
+            __Pyx_DECREF_SET(__pyx_v_reason_for_failure, ((PyObject *)__pyx_t_1));
             __pyx_t_1 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1657
@@ -57066,8 +56916,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
             __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_139), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(((PyObject *)__pyx_t_14));
             __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
-            __Pyx_DECREF(__pyx_v_reason_for_failure);
-            __pyx_v_reason_for_failure = ((PyObject *)__pyx_t_14);
+            __Pyx_DECREF_SET(__pyx_v_reason_for_failure, ((PyObject *)__pyx_t_14));
             __pyx_t_14 = 0;
           }
           __pyx_L58:;
@@ -57164,11 +57013,9 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
               {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               __pyx_L62_unpacking_done:;
             }
-            __Pyx_XDECREF(__pyx_v_phrase2);
-            __pyx_v_phrase2 = __pyx_t_1;
+            __Pyx_XDECREF_SET(__pyx_v_phrase2, __pyx_t_1);
             __pyx_t_1 = 0;
-            __Pyx_XDECREF(__pyx_v_eindexes);
-            __pyx_v_eindexes = __pyx_t_3;
+            __Pyx_XDECREF_SET(__pyx_v_eindexes, __pyx_t_3);
             __pyx_t_3 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1688
@@ -57184,8 +57031,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
             __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_15), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(__pyx_t_3);
             __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-            __Pyx_XDECREF(((PyObject *)__pyx_v_als1));
-            __pyx_v_als1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3);
+            __Pyx_XDECREF_SET(__pyx_v_als1, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3));
             __pyx_t_3 = 0;
 
             /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1689
@@ -57669,8 +57515,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
               __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               __Pyx_GOTREF(__pyx_t_15);
               __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_v_fphr));
-              __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_15);
+              __Pyx_DECREF_SET(__pyx_v_fphr, ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_15));
               __pyx_t_15 = 0;
 
               /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1737
@@ -57682,8 +57527,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
  */
               __pyx_t_15 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->extract_phrases(__pyx_v_self, __pyx_v_e_x_low, __pyx_v_e_x_high, __pyx_v_e_gap_low, __pyx_v_e_gap_high, __pyx_v_e_links_low, (__pyx_v_num_gaps + 1), __pyx_v_f_x_low, __pyx_v_f_x_high, __pyx_v_f_gap_low, __pyx_v_f_gap_high, __pyx_v_f_links_low, __pyx_v_matching->sent_id, __pyx_v_e_sent_len, __pyx_v_e_sent_start); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               __Pyx_GOTREF(__pyx_t_15);
-              __Pyx_XDECREF(__pyx_v_phrase_list);
-              __pyx_v_phrase_list = __pyx_t_15;
+              __Pyx_XDECREF_SET(__pyx_v_phrase_list, __pyx_t_15);
               __pyx_t_15 = 0;
 
               /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1738
@@ -57823,11 +57667,9 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
                   {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                   __pyx_L78_unpacking_done:;
                 }
-                __Pyx_XDECREF(__pyx_v_phrase2);
-                __pyx_v_phrase2 = __pyx_t_14;
+                __Pyx_XDECREF_SET(__pyx_v_phrase2, __pyx_t_14);
                 __pyx_t_14 = 0;
-                __Pyx_XDECREF(__pyx_v_eindexes);
-                __pyx_v_eindexes = __pyx_t_3;
+                __Pyx_XDECREF_SET(__pyx_v_eindexes, __pyx_t_3);
                 __pyx_t_3 = 0;
 
                 /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1743
@@ -57843,8 +57685,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
                 __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                 __Pyx_GOTREF(__pyx_t_3);
                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-                __Pyx_XDECREF(((PyObject *)__pyx_v_als2));
-                __pyx_v_als2 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3);
+                __Pyx_XDECREF_SET(__pyx_v_als2, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3));
                 __pyx_t_3 = 0;
 
                 /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1744
@@ -58293,8 +58134,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
               __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               __Pyx_GOTREF(__pyx_t_1);
               __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_v_fphr));
-              __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1);
+              __Pyx_DECREF_SET(__pyx_v_fphr, ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1));
               __pyx_t_1 = 0;
 
               /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1791
@@ -58306,8 +58146,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
  */
               __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->extract_phrases(__pyx_v_self, __pyx_v_e_x_low, __pyx_v_e_x_high, (__pyx_v_e_gap_low + __pyx_v_gap_start), (__pyx_v_e_gap_high + __pyx_v_gap_start), __pyx_v_e_links_low, (__pyx_v_num_gaps + 1), __pyx_v_f_x_low, __pyx_v_f_x_high, (__pyx_v_f_gap_low + __pyx_v_gap_start), (__pyx_v_f_gap_high + __pyx_v_gap_start), __pyx_v_f_links_low, __pyx_v_matching->sent_id, __pyx_v_e_sent_len, __pyx_v_e_sent_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_XDECREF(__pyx_v_phrase_list);
-              __pyx_v_phrase_list = __pyx_t_1;
+              __Pyx_XDECREF_SET(__pyx_v_phrase_list, __pyx_t_1);
               __pyx_t_1 = 0;
 
               /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1792
@@ -58447,11 +58286,9 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
                   {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                   __pyx_L93_unpacking_done:;
                 }
-                __Pyx_XDECREF(__pyx_v_phrase2);
-                __pyx_v_phrase2 = __pyx_t_15;
+                __Pyx_XDECREF_SET(__pyx_v_phrase2, __pyx_t_15);
                 __pyx_t_15 = 0;
-                __Pyx_XDECREF(__pyx_v_eindexes);
-                __pyx_v_eindexes = __pyx_t_3;
+                __Pyx_XDECREF_SET(__pyx_v_eindexes, __pyx_t_3);
                 __pyx_t_3 = 0;
 
                 /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1797
@@ -58467,8 +58304,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
                 __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_14), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                 __Pyx_GOTREF(__pyx_t_3);
                 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-                __Pyx_XDECREF(((PyObject *)__pyx_v_als3));
-                __pyx_v_als3 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3);
+                __Pyx_XDECREF_SET(__pyx_v_als3, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3));
                 __pyx_t_3 = 0;
 
                 /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1798
@@ -59077,8 +58913,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
               __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               __Pyx_GOTREF(__pyx_t_14);
               __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_v_fphr));
-              __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_14);
+              __Pyx_DECREF_SET(__pyx_v_fphr, ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_14));
               __pyx_t_14 = 0;
 
               /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1862
@@ -59090,8 +58925,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
  */
               __pyx_t_14 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->extract_phrases(__pyx_v_self, __pyx_v_e_x_low, __pyx_v_e_x_high, __pyx_v_e_gap_low, __pyx_v_e_gap_high, __pyx_v_e_links_low, (__pyx_v_num_gaps + 2), __pyx_v_f_x_low, __pyx_v_f_x_high, __pyx_v_f_gap_low, __pyx_v_f_gap_high, __pyx_v_f_links_low, __pyx_v_matching->sent_id, __pyx_v_e_sent_len, __pyx_v_e_sent_start); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               __Pyx_GOTREF(__pyx_t_14);
-              __Pyx_XDECREF(__pyx_v_phrase_list);
-              __pyx_v_phrase_list = __pyx_t_14;
+              __Pyx_XDECREF_SET(__pyx_v_phrase_list, __pyx_t_14);
               __pyx_t_14 = 0;
 
               /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1863
@@ -59231,11 +59065,9 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
                   {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                   __pyx_L111_unpacking_done:;
                 }
-                __Pyx_XDECREF(__pyx_v_phrase2);
-                __pyx_v_phrase2 = __pyx_t_1;
+                __Pyx_XDECREF_SET(__pyx_v_phrase2, __pyx_t_1);
                 __pyx_t_1 = 0;
-                __Pyx_XDECREF(__pyx_v_eindexes);
-                __pyx_v_eindexes = __pyx_t_3;
+                __Pyx_XDECREF_SET(__pyx_v_eindexes, __pyx_t_3);
                 __pyx_t_3 = 0;
 
                 /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1868
@@ -59251,8 +59083,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
                 __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_15), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                 __Pyx_GOTREF(__pyx_t_3);
                 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-                __Pyx_XDECREF(((PyObject *)__pyx_v_als4));
-                __pyx_v_als4 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3);
+                __Pyx_XDECREF_SET(__pyx_v_als4, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3));
                 __pyx_t_3 = 0;
 
                 /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1869
@@ -59316,8 +59147,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
  *         free(sent_links)
  */
       __Pyx_INCREF(((PyObject *)__pyx_kp_s_140));
-      __Pyx_DECREF(__pyx_v_reason_for_failure);
-      __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_140);
+      __Pyx_DECREF_SET(__pyx_v_reason_for_failure, ((PyObject *)__pyx_kp_s_140));
     }
     __pyx_L34:;
     goto __pyx_L33;
@@ -60043,8 +59873,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
     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 = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
-      __Pyx_XDECREF(__pyx_v_i);
-      __pyx_v_i = __pyx_t_8;
+      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8);
       __pyx_t_8 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1952
@@ -60117,8 +59946,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
       __pyx_t_2 = __pyx_t_4;
       __Pyx_INCREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_v_new_min_bound);
-      __pyx_v_new_min_bound = __pyx_t_2;
+      __Pyx_DECREF_SET(__pyx_v_new_min_bound, __pyx_t_2);
       __pyx_t_2 = 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 = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
@@ -60132,8 +59960,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
  */
     __pyx_t_2 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_2;
+    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
     __pyx_t_2 = 0;
     goto __pyx_L7;
   }
@@ -60151,8 +59978,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
     for (__pyx_t_9 = __pyx_t_11; __pyx_t_9 < __pyx_t_10; __pyx_t_9++) {
       __pyx_t_2 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_XDECREF(__pyx_v_i);
-      __pyx_v_i = __pyx_t_2;
+      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
       __pyx_t_2 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1958
@@ -60225,8 +60051,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
       __pyx_t_4 = __pyx_t_8;
       __Pyx_INCREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __Pyx_DECREF(__pyx_v_new_min_bound);
-      __pyx_v_new_min_bound = __pyx_t_4;
+      __Pyx_DECREF_SET(__pyx_v_new_min_bound, __pyx_t_4);
       __pyx_t_4 = 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 = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
@@ -60240,8 +60065,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
  */
     __pyx_t_4 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1961
@@ -60256,8 +60080,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
     for (__pyx_t_11 = __pyx_t_9+1; __pyx_t_11 <= __pyx_t_10; __pyx_t_11++) {
       __pyx_t_4 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_XDECREF(__pyx_v_i);
-      __pyx_v_i = __pyx_t_4;
+      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
       __pyx_t_4 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1962
@@ -60330,8 +60153,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
       __pyx_t_8 = __pyx_t_2;
       __Pyx_INCREF(__pyx_t_8);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_v_new_min_bound);
-      __pyx_v_new_min_bound = __pyx_t_8;
+      __Pyx_DECREF_SET(__pyx_v_new_min_bound, __pyx_t_8);
       __pyx_t_8 = 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 = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
@@ -60345,8 +60167,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
  */
     __pyx_t_8 = PyInt_FromLong(__pyx_t_11); 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_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_8;
+    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8);
     __pyx_t_8 = 0;
   }
   __pyx_L7:;
@@ -60415,8 +60236,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
         }
         __Pyx_GOTREF(__pyx_t_8);
       }
-      __Pyx_XDECREF(__pyx_v_link);
-      __pyx_v_link = __pyx_t_8;
+      __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_8);
       __pyx_t_8 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1969
@@ -60528,8 +60348,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
           }
           __Pyx_GOTREF(__pyx_t_8);
         }
-        __Pyx_XDECREF(__pyx_v_link);
-        __pyx_v_link = __pyx_t_8;
+        __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_8);
         __pyx_t_8 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1976
@@ -60747,8 +60566,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
           }
           __Pyx_GOTREF(__pyx_t_1);
         }
-        __Pyx_XDECREF(__pyx_v_link);
-        __pyx_v_link = __pyx_t_1;
+        __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_1);
         __pyx_t_1 = 0;
 
         /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1984
@@ -62002,8 +61820,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
       }
       __Pyx_GOTREF(__pyx_t_4);
     }
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_4;
+    __Pyx_XDECREF_SET(__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 = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
@@ -62067,8 +61884,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
       }
       __Pyx_GOTREF(__pyx_t_4);
     }
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
     __pyx_t_4 = 0;
     __pyx_t_4 = PyNumber_Add(__pyx_v_e_len, __pyx_int_1); 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);
@@ -62140,8 +61956,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
       }
       __Pyx_GOTREF(__pyx_t_6);
     }
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_6;
+    __Pyx_XDECREF_SET(__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 = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
@@ -62253,11 +62068,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
       {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L12_unpacking_done:;
     }
-    __Pyx_XDECREF(__pyx_v_f);
-    __pyx_v_f = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_4);
     __pyx_t_4 = 0;
-    __Pyx_XDECREF(__pyx_v_e);
-    __pyx_v_e = __pyx_t_6;
+    __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_6);
     __pyx_t_6 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1910
@@ -62684,14 +62497,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
       {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L19_unpacking_done:;
     }
-    __Pyx_XDECREF(__pyx_v_f);
-    __pyx_v_f = __pyx_t_14;
+    __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_14);
     __pyx_t_14 = 0;
-    __Pyx_XDECREF(__pyx_v_lex_i);
-    __pyx_v_lex_i = __pyx_t_7;
+    __Pyx_XDECREF_SET(__pyx_v_lex_i, __pyx_t_7);
     __pyx_t_7 = 0;
-    __Pyx_XDECREF(__pyx_v_lex_j);
-    __pyx_v_lex_j = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_lex_j, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2043
@@ -62739,8 +62549,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
       }
       __Pyx_GOTREF(__pyx_t_12);
     }
-    __Pyx_XDECREF(__pyx_v_rule);
-    __pyx_v_rule = __pyx_t_12;
+    __Pyx_XDECREF_SET(__pyx_v_rule, __pyx_t_12);
     __pyx_t_12 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2047
@@ -62810,16 +62619,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
       {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L23_unpacking_done:;
     }
-    __Pyx_XDECREF(__pyx_v_f_ph);
-    __pyx_v_f_ph = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_f_ph, __pyx_t_4);
     __pyx_t_4 = 0;
-    __Pyx_XDECREF(__pyx_v_e_ph);
-    __pyx_v_e_ph = __pyx_t_14;
+    __Pyx_XDECREF_SET(__pyx_v_e_ph, __pyx_t_14);
     __pyx_t_14 = 0;
     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_al);
-    __Pyx_DECREF(__pyx_cur_scope->__pyx_v_al);
+    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_al, __pyx_t_7);
     __Pyx_GIVEREF(__pyx_t_7);
-    __pyx_cur_scope->__pyx_v_al = __pyx_t_7;
     __pyx_t_7 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2048
@@ -62969,8 +62775,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
       }
       __Pyx_GOTREF(__pyx_t_12);
     }
-    __Pyx_XDECREF(__pyx_v_e_w);
-    __pyx_v_e_w = __pyx_t_12;
+    __Pyx_XDECREF_SET(__pyx_v_e_w, __pyx_t_12);
     __pyx_t_12 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2056
@@ -63037,8 +62842,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
       }
       __Pyx_GOTREF(__pyx_t_12);
     }
-    __Pyx_XDECREF(__pyx_v_f_w);
-    __pyx_v_f_w = __pyx_t_12;
+    __Pyx_XDECREF_SET(__pyx_v_f_w, __pyx_t_12);
     __pyx_t_12 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2058
@@ -63103,8 +62907,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
         }
         __Pyx_GOTREF(__pyx_t_7);
       }
-      __Pyx_XDECREF(__pyx_v_e_w);
-      __pyx_v_e_w = __pyx_t_7;
+      __Pyx_XDECREF_SET(__pyx_v_e_w, __pyx_t_7);
       __pyx_t_7 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2060
@@ -63624,14 +63427,12 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
       __pyx_L7_unpacking_done:;
     }
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_i);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_cur_scope->__pyx_v_i = __pyx_t_4;
     __pyx_t_4 = 0;
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_j);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_j);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_j, __pyx_t_5);
     __Pyx_GIVEREF(__pyx_t_5);
-    __pyx_cur_scope->__pyx_v_j = __pyx_t_5;
     __pyx_t_5 = 0;
     if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
     __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -63826,8 +63627,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
       }
       __Pyx_GOTREF(__pyx_t_2);
     }
-    __Pyx_XDECREF(__pyx_v_next_nt);
-    __pyx_v_next_nt = __pyx_t_2;
+    __Pyx_XDECREF_SET(__pyx_v_next_nt, __pyx_t_2);
     __pyx_t_2 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2070
@@ -63848,8 +63648,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
     __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_int_1); 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_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_XDECREF(__pyx_v_nt_len);
-    __pyx_v_nt_len = __pyx_t_1;
+    __Pyx_XDECREF_SET(__pyx_v_nt_len, __pyx_t_1);
     __pyx_t_1 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2071
@@ -63860,8 +63659,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  *                 f_sym.pop(next_nt[1] - off)
  */
     __Pyx_INCREF(__pyx_int_0);
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_int_0;
+    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_int_0);
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2072
  *             nt_len = (next_nt[2] - next_nt[1]) + 1
@@ -63910,8 +63708,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  */
       __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_v_i);
-      __pyx_v_i = __pyx_t_2;
+      __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_2);
       __pyx_t_2 = 0;
     }
 
@@ -63950,8 +63747,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
     __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_6); 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_6); __pyx_t_6 = 0;
-    __Pyx_DECREF(__pyx_v_off);
-    __pyx_v_off = __pyx_t_2;
+    __Pyx_DECREF_SET(__pyx_v_off, __pyx_t_2);
     __pyx_t_2 = 0;
   }
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -63984,8 +63780,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  *             nt_len = (next_nt[4] - next_nt[3]) + 1
  */
   __Pyx_INCREF(__pyx_v_e_i);
-  __Pyx_DECREF(__pyx_v_off);
-  __pyx_v_off = __pyx_v_e_i;
+  __Pyx_DECREF_SET(__pyx_v_off, __pyx_v_e_i);
 
   /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2079
  *         e_sym = list(e_span[:])
@@ -64028,8 +63823,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
       }
       __Pyx_GOTREF(__pyx_t_2);
     }
-    __Pyx_XDECREF(__pyx_v_next_nt);
-    __pyx_v_next_nt = __pyx_t_2;
+    __Pyx_XDECREF_SET(__pyx_v_next_nt, __pyx_t_2);
     __pyx_t_2 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2080
@@ -64050,8 +63844,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
     __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __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_XDECREF_SET(__pyx_v_nt_len, __pyx_t_6);
     __pyx_t_6 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2081
@@ -64062,8 +63855,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  *                 e_sym.pop(next_nt[3] - off)
  */
     __Pyx_INCREF(__pyx_int_0);
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_int_0;
+    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_int_0);
 
     /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2082
  *             nt_len = (next_nt[4] - next_nt[3]) + 1
@@ -64112,8 +63904,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  */
       __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_v_i);
-      __pyx_v_i = __pyx_t_2;
+      __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_2);
       __pyx_t_2 = 0;
     }
 
@@ -64152,8 +63943,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
     __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2086; __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);
-    __pyx_v_off = __pyx_t_2;
+    __Pyx_DECREF_SET(__pyx_v_off, __pyx_t_2);
     __pyx_t_2 = 0;
   }
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -64201,8 +63991,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
       }
       __Pyx_GOTREF(__pyx_t_1);
     }
-    __Pyx_XDECREF(__pyx_v_sub);
-    __pyx_v_sub = __pyx_t_1;
+    __Pyx_XDECREF_SET(__pyx_v_sub, __pyx_t_1);
     __pyx_t_1 = 0;
     if (PyList_CheckExact(__pyx_v_sub) || PyTuple_CheckExact(__pyx_v_sub)) {
       __pyx_t_1 = __pyx_v_sub; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
@@ -64238,8 +64027,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
         }
         __Pyx_GOTREF(__pyx_t_6);
       }
-      __Pyx_XDECREF(__pyx_v_link);
-      __pyx_v_link = __pyx_t_6;
+      __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_6);
       __pyx_t_6 = 0;
       __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
@@ -64314,8 +64102,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
   __pyx_t_4 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2092; __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 = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_v_nt_len);
-  __pyx_v_nt_len = __pyx_t_1;
+  __Pyx_XDECREF_SET(__pyx_v_nt_len, __pyx_t_1);
   __pyx_t_1 = 0;
 
   /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2093
@@ -64336,8 +64123,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  *         while i < links_len:
  */
   __Pyx_INCREF(__pyx_v_f_i);
-  __Pyx_DECREF(__pyx_v_off);
-  __pyx_v_off = __pyx_v_f_i;
+  __Pyx_DECREF_SET(__pyx_v_off, __pyx_v_f_i);
 
   /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2095
  *         nt_i = 0
@@ -64347,8 +64133,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  *             while nt_i < nt_len and links[i][0] > nt[nt_i][1]:
  */
   __Pyx_INCREF(__pyx_int_0);
-  __Pyx_XDECREF(__pyx_v_i);
-  __pyx_v_i = __pyx_int_0;
+  __Pyx_XDECREF_SET(__pyx_v_i, __pyx_int_0);
 
   /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2096
  *         off = f_i
@@ -64420,8 +64205,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
       __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_v_off);
-      __pyx_v_off = __pyx_t_2;
+      __Pyx_DECREF_SET(__pyx_v_off, __pyx_t_2);
       __pyx_t_2 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2099
@@ -64433,8 +64217,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  */
       __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __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_DECREF_SET(__pyx_v_nt_i, __pyx_t_2);
       __pyx_t_2 = 0;
     }
 
@@ -64466,8 +64249,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  */
     __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_2;
+    __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_2);
     __pyx_t_2 = 0;
   }
 
@@ -64479,8 +64261,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  *         i = 0
  */
   __Pyx_INCREF(__pyx_int_0);
-  __Pyx_DECREF(__pyx_v_nt_i);
-  __pyx_v_nt_i = __pyx_int_0;
+  __Pyx_DECREF_SET(__pyx_v_nt_i, __pyx_int_0);
 
   /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2103
  *             i += 1
@@ -64490,8 +64271,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  *         while i < links_len:
  */
   __Pyx_INCREF(__pyx_v_e_i);
-  __Pyx_DECREF(__pyx_v_off);
-  __pyx_v_off = __pyx_v_e_i;
+  __Pyx_DECREF_SET(__pyx_v_off, __pyx_v_e_i);
 
   /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2104
  *         nt_i = 0
@@ -64501,8 +64281,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  *             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;
+  __Pyx_DECREF_SET(__pyx_v_i, __pyx_int_0);
 
   /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2105
  *         off = e_i
@@ -64574,8 +64353,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
       __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __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_3;
+      __Pyx_DECREF_SET(__pyx_v_off, __pyx_t_3);
       __pyx_t_3 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2108
@@ -64587,8 +64365,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  */
       __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_v_nt_i);
-      __pyx_v_nt_i = __pyx_t_3;
+      __Pyx_DECREF_SET(__pyx_v_nt_i, __pyx_t_3);
       __pyx_t_3 = 0;
     }
 
@@ -64620,8 +64397,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
  */
     __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_3);
     __pyx_t_3 = 0;
   }
 
@@ -64706,8 +64482,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
       __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 = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_v_lex_f_i);
-      __pyx_v_lex_f_i = __pyx_t_1;
+      __Pyx_DECREF_SET(__pyx_v_lex_f_i, __pyx_t_1);
       __pyx_t_1 = 0;
       goto __pyx_L24;
     }
@@ -64758,8 +64533,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
       __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 = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_DECREF(__pyx_v_lex_f_j);
-      __pyx_v_lex_f_j = __pyx_t_1;
+      __Pyx_DECREF_SET(__pyx_v_lex_f_j, __pyx_t_1);
       __pyx_t_1 = 0;
       goto __pyx_L25;
     }
@@ -65061,9 +64835,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
       __Pyx_GOTREF(__pyx_t_4);
     }
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_packed);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_packed);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_packed, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_cur_scope->__pyx_v_packed = __pyx_t_4;
     __pyx_t_4 = 0;
     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_150), __pyx_n_s__format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
@@ -66021,8 +65794,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
       __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-      __Pyx_XDECREF(((PyObject *)__pyx_v_f));
-      __pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_4);
+      __Pyx_XDECREF_SET(__pyx_v_f, ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_4));
       __pyx_t_4 = 0;
 
       /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2174
@@ -66523,8 +66295,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
  */
     __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_v_k);
-    __pyx_v_k = __pyx_t_1;
+    __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
     __pyx_t_1 = 0;
   }
 
@@ -66695,8 +66466,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__py
  */
     __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_v_k);
-    __pyx_v_k = __pyx_t_1;
+    __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
     __pyx_t_1 = 0;
   }
 
@@ -66852,8 +66622,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__py
  */
     __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_v_k);
-    __pyx_v_k = __pyx_t_1;
+    __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
     __pyx_t_1 = 0;
   }
 
@@ -67350,9 +67119,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_7__str___2generator17(_
       __Pyx_GOTREF(__pyx_t_4);
     }
     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_feat);
-    __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_feat);
+    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_feat, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_cur_scope->__pyx_v_feat = __pyx_t_4;
     __pyx_t_4 = 0;
     __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_156), __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
@@ -67515,8 +67283,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(struct __pyx_obj_4cdec_2sa_3
     #else
     __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_model);
-    __pyx_v_model = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_model, __pyx_t_4);
     __pyx_t_4 = 0;
     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s____name__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
@@ -67701,11 +67468,9 @@ static struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_f_4cdec_2sa_3_sa_6Sc
       {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L6_unpacking_done:;
     }
-    __Pyx_XDECREF(__pyx_v_name);
-    __pyx_v_name = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
     __pyx_t_5 = 0;
-    __Pyx_XDECREF(__pyx_v_model);
-    __pyx_v_model = __pyx_t_6;
+    __Pyx_XDECREF_SET(__pyx_v_model, __pyx_t_6);
     __pyx_t_6 = 0;
 
     /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":32
@@ -67874,6 +67639,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_FeatureVector = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray __pyx_vtable_4cdec_2sa_3_sa_SuffixArray;
 
@@ -68023,6 +67791,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_SuffixArray = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice[8];
@@ -68140,6 +67911,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule[8];
@@ -68257,6 +68031,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_LCP(PyTypeObject *t, PyObject *a, PyObject *k) {
@@ -68364,6 +68141,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_LCP = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr[8];
@@ -68489,6 +68269,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_OnlineStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
@@ -68759,6 +68542,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_OnlineStats = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList __pyx_vtable_4cdec_2sa_3_sa_IntList;
 
@@ -68893,6 +68679,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_IntList = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase __pyx_vtable_4cdec_2sa_3_sa_Phrase;
 
@@ -69023,6 +68812,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Phrase = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_TrieNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
@@ -69139,6 +68931,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieNode = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr[8];
@@ -69264,6 +69059,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext[8];
@@ -69373,6 +69171,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext =
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr[8];
@@ -69498,6 +69299,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases[8];
@@ -69639,6 +69443,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrase
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_ExtendedTrieNode(PyTypeObject *t, PyObject *a, PyObject *k) {
@@ -69801,6 +69608,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment __pyx_vtable_4cdec_2sa_3_sa_Alignment;
 
@@ -69917,6 +69727,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Alignment = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_19_input[8];
@@ -70490,6 +70303,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_input = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words[8];
@@ -70599,6 +70415,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr[8];
@@ -70732,6 +70551,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Rule(PyTypeObject *t, PyObject *a, PyObject *k) {
@@ -70871,6 +70693,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Rule = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr[8];
@@ -70996,6 +70821,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation __pyx_vtable_4cdec_2sa_3_sa_Precomputation;
 
@@ -71107,6 +70935,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Precomputation = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__[8];
@@ -71216,6 +71047,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance[8];
@@ -71405,6 +71239,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap __pyx_vtable_4cdec_2sa_3_sa_TrieMap;
 
@@ -71495,6 +71332,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieMap = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments[8];
@@ -71620,6 +71460,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments =
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_VEBIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
@@ -71692,6 +71535,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_VEBIterator = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr[8];
@@ -71817,6 +71663,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList __pyx_vtable_4cdec_2sa_3_sa_FloatList;
 
@@ -71944,6 +71793,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_FloatList = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap __pyx_vtable_4cdec_2sa_3_sa_StringMap;
 
@@ -72031,6 +71883,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_StringMap = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__[8];
@@ -72140,6 +71995,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_16___str__[8];
@@ -72249,6 +72107,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_TrieTable(PyTypeObject *t, PyObject *a, PyObject *k) {
@@ -72395,6 +72256,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieTable = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words[8];
@@ -72504,6 +72368,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr[8];
@@ -72629,6 +72496,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr[8];
@@ -72754,6 +72624,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr[8];
@@ -72879,6 +72752,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule[8];
@@ -72996,6 +72872,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule =
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr[8];
@@ -73129,6 +73008,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB __pyx_vtable_4cdec_2sa_3_sa_VEB;
 
@@ -73237,6 +73119,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_VEB = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice[8];
@@ -73346,6 +73231,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattic
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_PhraseLocation __pyx_vtable_4cdec_2sa_3_sa_PhraseLocation;
 
@@ -73446,6 +73334,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_PhraseLocation = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Scorer __pyx_vtable_4cdec_2sa_3_sa_Scorer;
 
@@ -73543,6 +73434,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Scorer = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Sampler(PyTypeObject *t, PyObject *a, PyObject *k) {
@@ -73642,6 +73536,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Sampler = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet __pyx_vtable_4cdec_2sa_3_sa_Alphabet;
 
@@ -73781,6 +73678,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Alphabet = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex __pyx_vtable_4cdec_2sa_3_sa_BiLex;
 
@@ -73882,12 +73782,14 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa_BiLex(PyObject *o) {
 static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_BiLex[] = {
   {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_3write_binary, METH_O, __Pyx_DOCSTR(0)},
   {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_5read_binary, METH_O, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("get_e_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_7get_e_id, METH_O, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("get_f_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_9get_f_id, METH_O, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text, METH_O, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced, METH_O, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("get_score"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_5BiLex_16write_text)},
+  {__Pyx_NAMESTR("contains_e_word"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_7contains_e_word, METH_O, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("contains_f_word"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_9contains_f_word, METH_O, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("get_e_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_11get_e_id, METH_O, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("get_f_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_13get_f_id, METH_O, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_15read_text, METH_O, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_enhanced, METH_O, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("get_score"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_19get_score, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_21write_text, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_5BiLex_20write_text)},
   {0, 0, 0, 0}
 };
 
@@ -73945,6 +73847,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_BiLex = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray __pyx_vtable_4cdec_2sa_3_sa_DataArray;
 
@@ -74189,6 +74094,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_DataArray = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BitSetIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
@@ -74261,6 +74169,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_BitSetIterator = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory;
 
@@ -74506,6 +74417,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_28___str__[8];
@@ -74615,6 +74529,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats[8];
@@ -74764,6 +74681,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr[8];
@@ -74889,6 +74809,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct____iter__[8];
@@ -74998,6 +74921,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct____iter__ = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr[8];
@@ -75171,6 +75097,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BitSet(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
@@ -75277,6 +75206,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_BitSet = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence[8];
@@ -75386,6 +75318,9 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_senten
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyMethodDef __pyx_methods[] = {
@@ -75781,7 +75716,7 @@ static int __Pyx_InitCachedBuiltins(void) {
   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_builtin_map = __Pyx_GetBuiltinName(__pyx_n_s__map); if (!__pyx_builtin_map) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s__zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s__zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_builtin_cmp = __Pyx_GetBuiltinName(__pyx_n_s__cmp); if (!__pyx_builtin_cmp) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -76058,102 +75993,102 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GOTREF(__pyx_k_tuple_42);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":297
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":305
  * 
  *             # Re-read file, placing words into buckets
  *             f.seek(0)             # <<<<<<<<<<<<<<
  *             for line in f:
  *                 (fword, eword, score1, score2) = line.split()
  */
-  __pyx_k_tuple_45 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_45 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_45);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":281
  * 
  *         fcount = IntList()
  *         with gzip_or_text(filename) as f:             # <<<<<<<<<<<<<<
  *             # first loop merely establishes size of array objects
  *             for line in f:
  */
-  __pyx_k_tuple_46 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_46 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_46);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":339
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":347
  * 
  *         if i > j:
  *             raise Exception("Sort error in CLex")             # <<<<<<<<<<<<<<
  *         if i == j: #empty interval
  *             return
  */
-  __pyx_k_tuple_49 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_48)); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_49 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_48)); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_49);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":362
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":370
  *             for i in self.f_index:
  *                 f.write("%d " % i)
  *             f.write("\n")             # <<<<<<<<<<<<<<
  *             for i, s1, s2 in zip(self.e_index, self.col1, self.col2):
  *                 f.write("%d %f %f " % (i, s1, s2))
  */
-  __pyx_k_tuple_51 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_51 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_51);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":365
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":373
  *             for i, s1, s2 in zip(self.e_index, self.col1, self.col2):
  *                 f.write("%d %f %f " % (i, s1, s2))
  *             f.write("\n")             # <<<<<<<<<<<<<<
  *             for i, w in enumerate(self.id2fword):
  *                 f.write("%d %s " % (i, w))
  */
-  __pyx_k_tuple_53 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_53 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_53);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":368
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":376
  *             for i, w in enumerate(self.id2fword):
  *                 f.write("%d %s " % (i, w))
  *             f.write("\n")             # <<<<<<<<<<<<<<
  *             for i, w in enumerate(self.id2eword):
  *                 f.write("%d %s " % (i, w))
  */
-  __pyx_k_tuple_55 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_55 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_55);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":371
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":379
  *             for i, w in enumerate(self.id2eword):
  *                 f.write("%d %s " % (i, w))
  *             f.write("\n")             # <<<<<<<<<<<<<<
  * 
  * 
  */
-  __pyx_k_tuple_56 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_56 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_56);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":367
  * 
  *     def write_enhanced(self, char* filename):
  *         with open(filename, "w") as f:             # <<<<<<<<<<<<<<
  *             for i in self.f_index:
  *                 f.write("%d " % i)
  */
-  __pyx_k_tuple_57 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_57 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_57);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
 
-  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404
+  /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":412
  *         cdef i, N, e_id, f_id
  * 
  *         with open(filename, "w") as f:             # <<<<<<<<<<<<<<
  *             N = len(self.e_index)
  *             f_id = 0
  */
-  __pyx_k_tuple_59 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_59 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_59);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
 
@@ -77040,9 +76975,8 @@ PyMODINIT_FUNC PyInit__sa(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Alphabet)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(((PyObject *)__pyx_v_4cdec_2sa_3_sa_ALPHABET));
-  __Pyx_DECREF(((PyObject *)__pyx_v_4cdec_2sa_3_sa_ALPHABET));
+  __Pyx_DECREF_SET(__pyx_v_4cdec_2sa_3_sa_ALPHABET, ((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_t_1));
   __Pyx_GIVEREF(__pyx_t_1);
-  __pyx_v_4cdec_2sa_3_sa_ALPHABET = ((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_t_1);
   __pyx_t_1 = 0;
 
   /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":107
@@ -77393,9 +77327,8 @@ PyMODINIT_FUNC PyInit__sa(void)
   __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_StringMap)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_XGOTREF(((PyObject *)__pyx_v_4cdec_2sa_3_sa_FD));
-  __Pyx_DECREF(((PyObject *)__pyx_v_4cdec_2sa_3_sa_FD));
+  __Pyx_DECREF_SET(__pyx_v_4cdec_2sa_3_sa_FD, ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_t_3));
   __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_v_4cdec_2sa_3_sa_FD = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_t_3);
   __pyx_t_3 = 0;
 
   /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":3
@@ -78985,6 +78918,9 @@ static PyTypeObject __pyx_CyFunctionType_type = {
 #if PY_VERSION_HEX >= 0x02060000
     0,                                  /*tp_version_tag*/
 #endif
+#if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+    0,                                  /*tp_finalize*/
+#endif
 };
 static int __Pyx_CyFunction_init(void) {
 #if !CYTHON_COMPILING_IN_PYPY
@@ -80224,6 +80160,9 @@ static PyTypeObject __pyx_GeneratorType_type = {
 #if PY_VERSION_HEX >= 0x02060000
     0,                                  /*tp_version_tag*/
 #endif
+#if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+    0,                                  /*tp_finalize*/
+#endif
 };
 static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
                                                   PyObject *closure) {
diff --git a/python/cdec/sa/bilex.pxi b/python/cdec/sa/bilex.pxi
index 44bc0ce6..73ba99c1 100644
--- a/python/cdec/sa/bilex.pxi
+++ b/python/cdec/sa/bilex.pxi
@@ -249,6 +249,14 @@ cdef class BiLex:
         fclose(f)
 
 
+    def contains_e_word(self, eword):
+        return (eword in self.eword2id)
+
+
+    def contains_f_word(self, fword):
+        return (fword in self.fword2id)
+
+
     def get_e_id(self, eword):
         if eword not in self.eword2id:
             e_id = len(self.id2eword)
diff --git a/python/cdec/sa/extract.py b/python/cdec/sa/extract.py
index b6502c52..d8f14b11 100644
--- a/python/cdec/sa/extract.py
+++ b/python/cdec/sa/extract.py
@@ -12,12 +12,13 @@ from cdec.sa._sa import monitor_cpu
 
 extractor, prefix = None, None
 online, compress = False, False
+vocab = None
 
 def make_extractor(args):
     global extractor, prefix, online, compress
     signal.signal(signal.SIGINT, signal.SIG_IGN) # Let parent process catch Ctrl+C
     load_features(args.features)
-    extractor = cdec.sa.GrammarExtractor(args.config, online)
+    extractor = cdec.sa.GrammarExtractor(args.config, online, vocab)
     prefix = args.grammars
     online = args.online
     compress = args.compress
@@ -63,7 +64,7 @@ def extract(inp):
     return '<seg grammar="{}" id="{}">{}</seg>{}'.format(grammar_file, i, sentence, suffix)
 
 def main():
-    global online
+    global online, vocab
     logging.basicConfig(level=logging.INFO)
     parser = argparse.ArgumentParser(description='Extract grammars from a compiled corpus.')
     parser.add_argument('-c', '--config', required=True,
@@ -78,6 +79,8 @@ def main():
                         help='additional feature definitions')
     parser.add_argument('-o', '--online', action='store_true',
                         help='online grammar extraction')
+    parser.add_argument('-e', '--except-vocab', default=None,
+                        help='add LM and Lex except features (use with -o, pass vocab.gz)')
     parser.add_argument('-z', '--compress', action='store_true',
                         help='compress grammars with gzip')
     args = parser.parse_args()
@@ -91,6 +94,7 @@ def main():
             sys.exit(1)
 
     online = args.online
+    vocab = args.except_vocab
 
     start_time = monitor_cpu()
     if args.jobs > 1:
diff --git a/python/cdec/sa/extractor.py b/python/cdec/sa/extractor.py
index 5a95ded8..244f84be 100644
--- a/python/cdec/sa/extractor.py
+++ b/python/cdec/sa/extractor.py
@@ -1,16 +1,17 @@
 from itertools import chain
 import os, sys
 import cdec.configobj
+from cdec.sa._sa import gzip_or_text
 from cdec.sa.features import EgivenFCoherent, SampleCountF, CountEF,\
         MaxLexEgivenF, MaxLexFgivenE, IsSingletonF, IsSingletonFE,\
-        IsSupportedOnline
+        IsSupportedOnline, CountExceptLM, CountExceptLex
 import cdec.sa
 
 # maximum span of a grammar rule in TEST DATA
 MAX_INITIAL_SIZE = 15
 
 class GrammarExtractor:
-    def __init__(self, config, online=False, features=None):
+    def __init__(self, config, online=False, vocab=None, features=None):
         if isinstance(config, basestring):
             if not os.path.exists(config):
                 raise IOError('cannot read configuration from {0}'.format(config))
@@ -62,6 +63,10 @@ class GrammarExtractor:
         extended_features = []
         if online:
             extended_features.append(IsSupportedOnline)
+        if vocab:
+            vcb_set = set(line.strip() for line in gzip_or_text(vocab))
+            extended_features.append(CountExceptLM(vcb_set))
+            extended_features.append(CountExceptLex(tt))
             
         # TODO: use @cdec.sa.features decorator for standard features too
         # + add a mask to disable features
diff --git a/python/cdec/sa/features.py b/python/cdec/sa/features.py
index c8fc1cca..fe3fb2bd 100644
--- a/python/cdec/sa/features.py
+++ b/python/cdec/sa/features.py
@@ -140,3 +140,19 @@ def IsSupportedOnline(ctx): # Occurs in online data?
         return (ctx.online.paircount > 0.01)
     else:
         return False
+
+def CountExceptLM(vocab):
+    def CountExceptLM(ctx): # In bitext (inc online data) but NOT mono text
+        return sum(1 for e in ctx.ephrase.words if e not in vocab)
+    return CountExceptLM
+
+def CountExceptLex(ttable):
+    def CountExceptLex(ctx):
+        count = 0.0
+        for e in ctx.ephrase.words:
+            if not ttable.contains_e_word(e):
+                count += 1
+        return count
+    return CountExceptLex
+
+
-- 
cgit v1.2.3


From 73bc12bb80316362c3ba0c5a745bfc9591f88c55 Mon Sep 17 00:00:00 2001
From: Michael Denkowski <mdenkows@cs.cmu.edu>
Date: Mon, 24 Feb 2014 23:25:27 -0800
Subject: refactoring

---
 python/cdec/sa/features.py | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

(limited to 'python')

diff --git a/python/cdec/sa/features.py b/python/cdec/sa/features.py
index fe3fb2bd..f5cbdb8d 100644
--- a/python/cdec/sa/features.py
+++ b/python/cdec/sa/features.py
@@ -142,17 +142,11 @@ def IsSupportedOnline(ctx): # Occurs in online data?
         return False
 
 def CountExceptLM(vocab):
-    def CountExceptLM(ctx): # In bitext (inc online data) but NOT mono text
+    def CountExceptLM(ctx): # Word count in bitext (inc online data) but NOT mono text
         return sum(1 for e in ctx.ephrase.words if e not in vocab)
     return CountExceptLM
 
 def CountExceptLex(ttable):
-    def CountExceptLex(ctx):
-        count = 0.0
-        for e in ctx.ephrase.words:
-            if not ttable.contains_e_word(e):
-                count += 1
-        return count
+    def CountExceptLex(ctx): # Word count in online data but NOT original bitext
+        return sum(1 for e in ctx.ephrase.words if not ttable.contains_e_word(e))
     return CountExceptLex
-
-
-- 
cgit v1.2.3


From 75fc827d0f6364c4e69f949abcbaf858f6735193 Mon Sep 17 00:00:00 2001
From: Michael Denkowski <mdenkows@cs.cmu.edu>
Date: Wed, 26 Feb 2014 12:15:02 -0800
Subject: Comments

---
 python/cdec/sa/features.py     | 3 ++-
 python/cdec/sa/rulefactory.pxi | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

(limited to 'python')

diff --git a/python/cdec/sa/features.py b/python/cdec/sa/features.py
index f5cbdb8d..dcc60401 100644
--- a/python/cdec/sa/features.py
+++ b/python/cdec/sa/features.py
@@ -147,6 +147,7 @@ def CountExceptLM(vocab):
     return CountExceptLM
 
 def CountExceptLex(ttable):
-    def CountExceptLex(ctx): # Word count in online data but NOT original bitext
+    def CountExceptLex(ctx): # Word count in online data but NOT aligned in original bitext
+        # TODO: Check that online data actually contains aligned word when rulefactory TODO is addressed.
         return sum(1 for e in ctx.ephrase.words if not ttable.contains_e_word(e))
     return CountExceptLex
diff --git a/python/cdec/sa/rulefactory.pxi b/python/cdec/sa/rulefactory.pxi
index 2be5cad6..78a23196 100644
--- a/python/cdec/sa/rulefactory.pxi
+++ b/python/cdec/sa/rulefactory.pxi
@@ -2052,6 +2052,7 @@ cdef class HieroCachingRuleFactory:
                 stats.phrases_al[f_ph][e_ph] = al
             
         # Update Bilexical counts
+        # TODO: use alignments instead of cooc
         for e_w in e_words:
             stats.bilex_e[e_w] += 1
         for f_w in f_words:
-- 
cgit v1.2.3