summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorVictor Chahuneau <vchahune@cs.cmu.edu>2012-08-08 18:56:02 -0400
committerVictor Chahuneau <vchahune@cs.cmu.edu>2012-08-08 18:56:02 -0400
commite0eabf1e59cbfa85b00efcff699cdcd6a524e9c5 (patch)
treee6d013ebdb0eafc8e1e380e84549460847d685ac /python
parentcc5584e9b066e6d1177495f7028ff49ab057ed52 (diff)
[python] Get rid of the GIL
Diffstat (limited to 'python')
-rw-r--r--python/pkg/cdec/__init__.py3
-rw-r--r--python/setup.py54
-rw-r--r--python/src/_cdec.cpp3922
-rw-r--r--python/src/_cdec.pyx5
-rw-r--r--python/src/decoder.pxd9
-rw-r--r--python/src/grammar.pxd4
-rw-r--r--python/src/hypergraph.pxd30
-rw-r--r--python/src/hypergraph.pxi13
-rw-r--r--python/src/kbest.pxd4
9 files changed, 2417 insertions, 1627 deletions
diff --git a/python/pkg/cdec/__init__.py b/python/pkg/cdec/__init__.py
index 531fea49..8e10f340 100644
--- a/python/pkg/cdec/__init__.py
+++ b/python/pkg/cdec/__init__.py
@@ -1 +1,2 @@
-from cdec._cdec import Decoder, Lattice, TRule, MRule, NT, NTRef, ParseFailed, InvalidConfig
+from cdec._cdec import Decoder, Lattice, TRule, MRule, NT, NTRef,\
+ ParseFailed, InvalidConfig, set_silent
diff --git a/python/setup.py b/python/setup.py
index 7be976e8..54510024 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -1,45 +1,41 @@
from distutils.core import setup
from distutils.extension import Extension
import sys
-import os
-import glob
+import re
+
+def fail(msg):
+ sys.stderr.write(msg)
+ sys.exit(1)
INC = ['..', 'src/', '../decoder', '../utils', '../mteval']
LIB = ['../decoder', '../utils', '../mteval', '../training', '../klm/lm', '../klm/util']
-LINK_ARGS = []
-
-# Detect Boost
-BOOST_ROOT = os.getenv('BOOST_ROOT')
-if BOOST_ROOT:
- BOOST_INC = os.path.join(BOOST_ROOT, 'include')
- BOOST_LIB = os.path.join(BOOST_ROOT, 'lib')
- if not os.path.exists(BOOST_INC):
- sys.stderr.write('Error: could not find Boost headers in <%s>\n' % BOOST_INC)
- sys.exit(1)
- if not os.path.exists(BOOST_LIB):
- sys.stderr.write('Error: could not find Boost libraries in <%s>\n' % BOOST_LIB)
- sys.exit(1)
- INC.append(BOOST_INC)
- LIB.append(BOOST_LIB)
- LINK_ARGS += ['-Wl,-rpath', '-Wl,'+BOOST_LIB]
-else:
- BOOST_LIB = '/usr/local/lib'
-# Detect -mt
-if glob.glob(os.path.join(BOOST_LIB, 'libboost_program_options-mt.*')):
- BOOST_PROGRAM_OPTIONS = 'boost_program_options-mt'
-else:
- BOOST_PROGRAM_OPTIONS = 'boost_program_options'
+try:
+ with open('../config.status') as config:
+ config = config.read()
+ subs = dict(re.findall('s,@(\w+)@,\|#_!!_#\|(.*),g', config)) # sed
+ if not subs:
+ subs = dict(re.findall('S\["(\w+)"\]="(.*)"', config)) # awk
+ if not subs:
+ fail('Cannot parse config.status\n'
+ 'Please report this bug to the developers')
+ LIBS = re.findall('-l([^\s]+)', subs['LIBS'])
+ CPPFLAGS = re.findall('-[^R][^\s]+', subs['CPPFLAGS'])
+ LDFLAGS = re.findall('-[^\s]+', subs['LDFLAGS'])
+ LDFLAGS = [opt.replace('-R', '-Wl,-rpath,') for opt in LDFLAGS]
+except IOError:
+ fail('Did you run ./configure? Cannot find config.status')
+except KeyError as e:
+ fail('Cannot find option {0} in config.status'.format(e))
ext_modules = [
Extension(name='cdec._cdec',
sources=['src/_cdec.cpp'],
include_dirs=INC,
library_dirs=LIB,
- libraries=[BOOST_PROGRAM_OPTIONS, 'z',
- 'cdec', 'utils', 'mteval', 'training', 'klm', 'klm_util'],
- extra_compile_args=['-DHAVE_CONFIG_H'],
- extra_link_args=LINK_ARGS),
+ libraries=LIBS + ['z', 'cdec', 'utils', 'mteval', 'training', 'klm', 'klm_util'],
+ extra_compile_args=CPPFLAGS,
+ extra_link_args=LDFLAGS),
Extension(name='cdec.sa._sa',
sources=['src/sa/_sa.c', 'src/sa/strmap.cc'])
]
diff --git a/python/src/_cdec.cpp b/python/src/_cdec.cpp
index 4b02edd5..87b836f1 100644
--- a/python/src/_cdec.cpp
+++ b/python/src/_cdec.cpp
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.16 on Tue Aug 7 23:28:20 2012 */
+/* Generated by Cython 0.17.beta1 on Wed Aug 8 18:52:57 2012 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -47,12 +47,6 @@
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
-#if CYTHON_COMPILING_IN_PYPY
- #define __Pyx_PyCFunction_Call PyObject_Call
-#else
- #define __Pyx_PyCFunction_Call PyCFunction_Call
-#endif
-
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
@@ -60,8 +54,11 @@
#define PY_FORMAT_SIZE_T ""
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
#define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o)
- #define PyNumber_Index(o) PyNumber_Int(o)
- #define PyIndex_Check(o) PyNumber_Check(o)
+ #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
+ (PyErr_Format(PyExc_TypeError, \
+ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
+ (PyObject*)0))
+ #define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
#define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#define __PYX_BUILD_PY_SSIZE_T "i"
#else
@@ -130,14 +127,20 @@
#endif
-#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH)
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
#define CYTHON_PEP393_ENABLED 1
- #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
#else
#define CYTHON_PEP393_ENABLED 0
- #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+
+ #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if PY_MAJOR_VERSION >= 3
@@ -270,6 +273,7 @@
#include <math.h>
#define __PYX_HAVE___cdec
#define __PYX_HAVE_API___cdec
+#include "string.h"
#include <string>
#include <vector>
#include <utility>
@@ -357,7 +361,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
+#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#ifdef __GNUC__
@@ -456,7 +464,7 @@ struct __pyx_opt_args_5_cdec_as_str {
char *error_msg;
};
-/* "/home/cdyer/cdec/python/src/mteval.pxi":117
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":117
* return CandidateSet(self)
*
* cdef class Scorer: # <<<<<<<<<<<<<<
@@ -470,7 +478,7 @@ struct __pyx_obj_5_cdec_Scorer {
};
-/* "/home/cdyer/cdec/python/src/grammar.pxi":20
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":20
* return '[%s]' % self.cat
*
* cdef class NTRef: # <<<<<<<<<<<<<<
@@ -483,7 +491,7 @@ struct __pyx_obj_5_cdec_NTRef {
};
-/* "/home/cdyer/cdec/python/src/cdec.sa._sa.pxd":1
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":1
* cdef class Phrase: # <<<<<<<<<<<<<<
* cdef int *syms
* cdef int n, *varpos, n_vars
@@ -498,7 +506,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Phrase {
};
-/* "/home/cdyer/cdec/python/src/mteval.pxi":90
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":90
* return candidate
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -514,7 +522,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ {
};
-/* "/home/cdyer/cdec/python/src/grammar.pxi":181
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":181
* super(MRule, self).__init__(lhs, rhs, e, scores, a)
*
* cdef class Grammar: # <<<<<<<<<<<<<<
@@ -527,7 +535,7 @@ struct __pyx_obj_5_cdec_Grammar {
};
-/* "/home/cdyer/cdec/python/src/lattice.pxi":58
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
*
* def todot(self):
* def lines(): # <<<<<<<<<<<<<<
@@ -550,12 +558,12 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines {
};
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":88
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":91
* del hypos
*
* def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
* cdef vector[string]* trees = new vector[string]()
- * if self.rng == NULL:
+ * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees)
*/
struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees {
PyObject_HEAD
@@ -568,7 +576,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees {
};
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":125
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":126
*
* property edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -584,7 +592,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ {
};
-/* "/home/cdyer/cdec/python/src/grammar.pxi":5
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
@@ -597,7 +605,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase {
};
-/* "/home/cdyer/cdec/python/src/mteval.pxi":65
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":65
* return result
*
* cdef class CandidateSet: # <<<<<<<<<<<<<<
@@ -612,7 +620,7 @@ struct __pyx_obj_5_cdec_CandidateSet {
};
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":131
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":132
*
* property nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -628,7 +636,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ {
};
-/* "/home/cdyer/cdec/python/src/grammar.pxi":50
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":50
* return TRule(lhs, f, e, scores, a)
*
* cdef class TRule: # <<<<<<<<<<<<<<
@@ -641,7 +649,7 @@ struct __pyx_obj_5_cdec_TRule {
};
-/* "/home/cdyer/cdec/python/src/cdec.sa._sa.pxd":7
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":7
* cdef public int chunklen(self, int k)
*
* cdef class Rule: # <<<<<<<<<<<<<<
@@ -659,7 +667,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Rule {
};
-/* "/home/cdyer/cdec/python/src/grammar.pxi":169
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":169
* _phrase(self.f), _phrase(self.e), scores)
*
* cdef class MRule(TRule): # <<<<<<<<<<<<<<
@@ -671,7 +679,7 @@ struct __pyx_obj_5_cdec_MRule {
};
-/* "/home/cdyer/cdec/python/src/mteval.pxi":98
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":98
* self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get())
*
* cdef class SegmentEvaluator: # <<<<<<<<<<<<<<
@@ -685,7 +693,7 @@ struct __pyx_obj_5_cdec_SegmentEvaluator {
};
-/* "_cdec.pyx":54
+/* "_cdec.pyx":57
* 'csplit', 'tagger', 'lexalign'):
* raise InvalidConfig('formalism "%s" unknown' % formalism)
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config)) # <<<<<<<<<<<<<<
@@ -701,21 +709,13 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr {
PyObject *(*__pyx_t_2)(PyObject *);
};
-
-/* "/home/cdyer/cdec/python/src/lattice.pxi":57
- * yield self[i]
- *
- * def todot(self): # <<<<<<<<<<<<<<
- * def lines():
- * yield 'digraph lattice {'
- */
struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot {
PyObject_HEAD
struct __pyx_obj_5_cdec_Lattice *__pyx_v_self;
};
-/* "/home/cdyer/cdec/python/src/mteval.pxi":12
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":12
* return stats
*
* cdef class Candidate: # <<<<<<<<<<<<<<
@@ -729,7 +729,7 @@ struct __pyx_obj_5_cdec_Candidate {
};
-/* "/home/cdyer/cdec/python/src/grammar.pxi":165
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":165
*
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
@@ -746,7 +746,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr {
};
-/* "/home/cdyer/cdec/python/src/grammar.pxi":8
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":8
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
*
* cdef class NT: # <<<<<<<<<<<<<<
@@ -760,7 +760,7 @@ struct __pyx_obj_5_cdec_NT {
};
-/* "_cdec.pyx":43
+/* "_cdec.pyx":46
* cdef DenseVector weights
*
* def __cinit__(self, config_str=None, **config): # <<<<<<<<<<<<<<
@@ -773,7 +773,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ {
};
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":159
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":160
* return vector
*
* cdef class HypergraphEdge: # <<<<<<<<<<<<<<
@@ -789,7 +789,7 @@ struct __pyx_obj_5_cdec_HypergraphEdge {
};
-/* "/home/cdyer/cdec/python/src/vectors.pxi":67
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":67
* self.vector.set_value(fid, value)
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -806,7 +806,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ {
};
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":215
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":216
*
* property in_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -822,7 +822,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ {
};
-/* "/home/cdyer/cdec/python/src/grammar.pxi":124
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":124
*
* property a:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -839,7 +839,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ {
};
-/* "/home/cdyer/cdec/python/src/lattice.pxi":52
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":52
* return hypergraph.AsPLF(self.lattice[0], True).c_str()
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -855,7 +855,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ {
};
-/* "_cdec.pyx":39
+/* "_cdec.pyx":42
* yield key, bytes(value)
*
* cdef class Decoder: # <<<<<<<<<<<<<<
@@ -869,7 +869,7 @@ struct __pyx_obj_5_cdec_Decoder {
};
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":205
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":206
* raise NotImplemented('comparison not implemented for HypergraphEdge')
*
* cdef class HypergraphNode: # <<<<<<<<<<<<<<
@@ -884,7 +884,7 @@ struct __pyx_obj_5_cdec_HypergraphNode {
};
-/* "/home/cdyer/cdec/python/src/vectors.pxi":45
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":45
* return sparse
*
* cdef class SparseVector: # <<<<<<<<<<<<<<
@@ -897,7 +897,7 @@ struct __pyx_obj_5_cdec_SparseVector {
};
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":221
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":222
*
* property out_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -913,7 +913,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ {
};
-/* "/home/cdyer/cdec/python/src/vectors.pxi":31
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":31
* self.vector[0][fid] = value
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -929,7 +929,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ {
};
-/* "/home/cdyer/cdec/python/src/mteval.pxi":44
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":44
* return self.stats.size()
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -946,7 +946,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ {
};
-/* "/home/cdyer/cdec/python/src/vectors.pxi":3
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":3
* from cython.operator cimport preincrement as pinc
*
* cdef class DenseVector: # <<<<<<<<<<<<<<
@@ -960,7 +960,7 @@ struct __pyx_obj_5_cdec_DenseVector {
};
-/* "/home/cdyer/cdec/python/src/grammar.pxi":187
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":187
* del self.grammar
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -979,7 +979,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ {
};
-/* "/home/cdyer/cdec/python/src/mteval.pxi":173
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":173
* out.fields[i] = ss[i]
*
* cdef class Metric: # <<<<<<<<<<<<<<
@@ -992,7 +992,7 @@ struct __pyx_obj_5_cdec_Metric {
};
-/* "/home/cdyer/cdec/python/src/mteval.pxi":26
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":26
* return fmap
*
* cdef class SufficientStats: # <<<<<<<<<<<<<<
@@ -1006,7 +1006,7 @@ struct __pyx_obj_5_cdec_SufficientStats {
};
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":31
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":36
* return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
*
* def kbest(self, size): # <<<<<<<<<<<<<<
@@ -1025,7 +1025,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest {
};
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":61
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":66
* del e_derivations
*
* def kbest_features(self, size): # <<<<<<<<<<<<<<
@@ -1045,7 +1045,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features {
};
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":179
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":180
*
* property tail_nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -1061,7 +1061,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ {
};
-/* "/home/cdyer/cdec/python/src/grammar.pxi":164
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":164
* self.rule.get().lhs_ = -TDConvert(<char *>lhs.cat)
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -1074,7 +1074,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ {
};
-/* "/home/cdyer/cdec/python/src/grammar.pxi":6
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
@@ -1091,7 +1091,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr {
};
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":43
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":48
* del derivations
*
* def kbest_trees(self, size): # <<<<<<<<<<<<<<
@@ -1114,7 +1114,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees {
};
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":4
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":4
* cimport kbest
*
* cdef class Hypergraph: # <<<<<<<<<<<<<<
@@ -1123,12 +1123,13 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees {
*/
struct __pyx_obj_5_cdec_Hypergraph {
PyObject_HEAD
+ struct __pyx_vtabstruct_5_cdec_Hypergraph *__pyx_vtab;
Hypergraph *hg;
MT19937 *rng;
};
-/* "/home/cdyer/cdec/python/src/lattice.pxi":3
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":3
* cimport lattice
*
* cdef class Lattice: # <<<<<<<<<<<<<<
@@ -1141,12 +1142,12 @@ struct __pyx_obj_5_cdec_Lattice {
};
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":76
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":81
* del derivations
*
* def sample(self, unsigned n): # <<<<<<<<<<<<<<
* cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
- * if self.rng == NULL:
+ * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos)
*/
struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample {
PyObject_HEAD
@@ -1159,8 +1160,8 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample {
};
-/* "_cdec.pyx":28
- * class ParseFailed(Exception): pass
+/* "_cdec.pyx":31
+ * SetSilent(yn)
*
* def _make_config(config): # <<<<<<<<<<<<<<
* for key, value in config.items():
@@ -1182,7 +1183,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config {
};
-/* "/home/cdyer/cdec/python/src/grammar.pxi":204
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":204
* self.grammar.get().SetGrammarName(string(<char *>name))
*
* cdef class TextGrammar(Grammar): # <<<<<<<<<<<<<<
@@ -1195,7 +1196,21 @@ struct __pyx_obj_5_cdec_TextGrammar {
-/* "/home/cdyer/cdec/python/src/cdec.sa._sa.pxd":1
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":4
+ * cimport kbest
+ *
+ * cdef class Hypergraph: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef MT19937* rng
+ */
+
+struct __pyx_vtabstruct_5_cdec_Hypergraph {
+ MT19937 *(*_rng)(struct __pyx_obj_5_cdec_Hypergraph *);
+};
+static struct __pyx_vtabstruct_5_cdec_Hypergraph *__pyx_vtabptr_5_cdec_Hypergraph;
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":1
* cdef class Phrase: # <<<<<<<<<<<<<<
* cdef int *syms
* cdef int n, *varpos, n_vars
@@ -1208,7 +1223,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *__pyx_vtabptr_4cdec_2sa_3_sa_Phrase;
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":205
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":206
* raise NotImplemented('comparison not implemented for HypergraphEdge')
*
* cdef class HypergraphNode: # <<<<<<<<<<<<<<
@@ -1222,7 +1237,7 @@ struct __pyx_vtabstruct_5_cdec_HypergraphNode {
static struct __pyx_vtabstruct_5_cdec_HypergraphNode *__pyx_vtabptr_5_cdec_HypergraphNode;
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":159
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":160
* return vector
*
* cdef class HypergraphEdge: # <<<<<<<<<<<<<<
@@ -1318,13 +1333,28 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
const char* function_name); /*proto*/
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+ PyListObject* L = (PyListObject*) list;
+ Py_ssize_t len = Py_SIZE(list);
+ if (likely(L->allocated > len)) {
+ Py_INCREF(x);
+ PyList_SET_ITEM(list, len, x);
+ Py_SIZE(list) = len+1;
+ return 0;
+ }
+ return PyList_Append(list, x);
+}
+#else
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
+#endif
+
static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
if (likely(PyList_CheckExact(L))) {
- if (PyList_Append(L, x) < 0) return NULL;
+ if (unlikely(PyList_Append(L, x) < 0)) return NULL;
Py_INCREF(Py_None);
return Py_None; /* this is just to have an accurate signature */
- }
- else {
+ } else {
PyObject *r, *m;
m = __Pyx_GetAttrString(L, "append");
if (!m) return NULL;
@@ -1345,42 +1375,47 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j
__Pyx_GetItemInt_List_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
- if (likely(o != Py_None)) {
- if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
- PyObject *r = PyList_GET_ITEM(o, i);
- Py_INCREF(r);
- return r;
- }
- else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
- PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
- Py_INCREF(r);
- return r;
- }
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+ PyObject *r = PyList_GET_ITEM(o, i);
+ Py_INCREF(r);
+ return r;
+ }
+ else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
+ PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
+ Py_INCREF(r);
+ return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+ return PySequence_GetItem(o, i);
+#endif
}
#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_Tuple_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
- if (likely(o != Py_None)) {
- if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
- PyObject *r = PyTuple_GET_ITEM(o, i);
- Py_INCREF(r);
- return r;
- }
- else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
- PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
- Py_INCREF(r);
- return r;
- }
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+ PyObject *r = PyTuple_GET_ITEM(o, i);
+ Py_INCREF(r);
+ return r;
+ }
+ else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
+ PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
+ Py_INCREF(r);
+ return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+ return PySequence_GetItem(o, i);
+#endif
}
#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
+#if CYTHON_COMPILING_IN_CPYTHON
if (PyList_CheckExact(o)) {
Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
@@ -1396,19 +1431,30 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i)
Py_INCREF(r);
return r;
}
- }
- else if (likely(i >= 0)) {
+ } else { /* inlined PySequence_GetItem() */
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
if (likely(m && m->sq_item)) {
+ if (unlikely(i < 0) && likely(m->sq_length)) {
+ Py_ssize_t l = m->sq_length(o);
+ if (unlikely(l < 0)) return NULL;
+ i += l;
+ }
return m->sq_item(o, i);
}
}
+#else
+ if (PySequence_Check(o)) {
+ return PySequence_GetItem(o, i);
+ }
+#endif
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
@@ -1419,13 +1465,20 @@ static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}
-#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL);
+#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); /*proto*/
static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
+#if CYTHON_COMPILING_IN_PYPY
+#define __Pyx_PyObject_AsDouble(obj) \
+(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \
+ likely(PyInt_CheckExact(obj)) ? \
+ PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
+#else
#define __Pyx_PyObject_AsDouble(obj) \
((likely(PyFloat_CheckExact(obj))) ? \
PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
+#endif
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
@@ -1439,6 +1492,45 @@ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
PyObject *modname); /*proto*/
+#ifndef __Pyx_CppExn2PyErr
+#include <new>
+#include <typeinfo>
+#include <stdexcept>
+#include <ios>
+static void __Pyx_CppExn2PyErr() {
+ try {
+ if (PyErr_Occurred())
+ ; // let the latest Python exn pass through and ignore the current one
+ else
+ throw;
+ } catch (const std::bad_alloc& exn) {
+ PyErr_SetString(PyExc_MemoryError, exn.what());
+ } catch (const std::bad_cast& exn) {
+ PyErr_SetString(PyExc_TypeError, exn.what());
+ } catch (const std::domain_error& exn) {
+ PyErr_SetString(PyExc_ValueError, exn.what());
+ } catch (const std::invalid_argument& exn) {
+ PyErr_SetString(PyExc_ValueError, exn.what());
+ } catch (const std::ios_base::failure& exn) {
+ PyErr_SetString(PyExc_IOError, exn.what());
+ } catch (const std::out_of_range& exn) {
+ PyErr_SetString(PyExc_IndexError, exn.what());
+ } catch (const std::overflow_error& exn) {
+ PyErr_SetString(PyExc_OverflowError, exn.what());
+ } catch (const std::range_error& exn) {
+ PyErr_SetString(PyExc_ArithmeticError, exn.what());
+ } catch (const std::underflow_error& exn) {
+ PyErr_SetString(PyExc_ArithmeticError, exn.what());
+ } catch (const std::exception& exn) {
+ PyErr_SetString(PyExc_RuntimeError, exn.what());
+ }
+ catch (...)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
+ }
+}
+#endif
+
static CYTHON_INLINE WordID __Pyx_PyInt_from_py_WordID(PyObject *);
static PyObject* __Pyx_Globals(void); /*proto*/
@@ -1536,6 +1628,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value,
#define __Pyx_Generator_USED
#include <structmember.h>
+#include <frameobject.h>
typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *);
typedef struct {
PyObject_HEAD
@@ -1548,10 +1641,17 @@ typedef struct {
PyObject *exc_traceback;
PyObject *gi_weakreflist;
PyObject *classobj;
+ PyObject *yieldfrom;
} __pyx_GeneratorObject;
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
PyObject *closure);
static int __pyx_Generator_init(void);
+static int __Pyx_Generator_clear(PyObject* self);
+#if 1 || PY_VERSION_HEX < 0x030300B0
+static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
+#else
+#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
+#endif
static int __Pyx_check_binary_version(void);
@@ -1593,6 +1693,8 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
+/* Module declarations from 'libc.string' */
+
/* Module declarations from 'libcpp.string' */
/* Module declarations from 'libcpp.vector' */
@@ -1826,7 +1928,8 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p
static PyObject *__pyx_pf_5_cdec_6Metric_2__call__(struct __pyx_obj_5_cdec_Metric *__pyx_v_self, PyObject *__pyx_v_refs); /* proto */
static PyObject *__pyx_pf_5_cdec_6Metric_4score(CYTHON_UNUSED struct __pyx_obj_5_cdec_Metric *__pyx_v_stats); /* proto */
static PyObject *__pyx_pf_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __pyx_obj_5_cdec_Metric *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_hyp, CYTHON_UNUSED PyObject *__pyx_v_refs); /* proto */
-static PyObject *__pyx_pf_5_cdec_2_make_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config); /* proto */
+static PyObject *__pyx_pf_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_yn); /* proto */
+static PyObject *__pyx_pf_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config); /* proto */
static PyObject *__pyx_pf_5_cdec_7Decoder_9__cinit___genexpr(PyObject *__pyx_self); /* proto */
static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_config_str, PyObject *__pyx_v_config); /* proto */
static void __pyx_pf_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Decoder *__pyx_v_self); /* proto */
@@ -1859,7 +1962,7 @@ static char __pyx_k_27[] = "digraph lattice {";
static char __pyx_k_32[] = "\\\"";
static char __pyx_k_34[] = "%d [shape=doublecircle]";
static char __pyx_k_35[] = "}";
-static char __pyx_k_38[] = "/home/cdyer/cdec/python/src/lattice.pxi";
+static char __pyx_k_38[] = "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi";
static char __pyx_k_39[] = "\n";
static char __pyx_k_41[] = "sufficient stats vector index out of range";
static char __pyx_k_43[] = "candidate set index out of range";
@@ -1871,14 +1974,15 @@ static char __pyx_k_50[] = "#";
static char __pyx_k_53[] = "Cannot translate input type %s";
static char __pyx_k_54[] = "cdec.sa._sa";
static char __pyx_k_55[] = "*";
-static char __pyx_k_58[] = "/home/cdyer/cdec/python/src/grammar.pxi";
-static char __pyx_k_64[] = "/home/cdyer/cdec/python/src/_cdec.pyx";
+static char __pyx_k_58[] = "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi";
+static char __pyx_k_64[] = "/Users/vchahun/Sandbox/cdec/python/src/_cdec.pyx";
static char __pyx_k__a[] = "a";
static char __pyx_k__e[] = "e";
static char __pyx_k__f[] = "f";
static char __pyx_k__i[] = "i";
static char __pyx_k__k[] = "k";
static char __pyx_k__pb[] = "pb";
+static char __pyx_k__yn[] = "yn";
static char __pyx_k__CER[] = "CER";
static char __pyx_k__TER[] = "TER";
static char __pyx_k___sa[] = "_sa";
@@ -1954,6 +2058,7 @@ static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k__beam_alpha[] = "beam_alpha";
static char __pyx_k__config_str[] = "config_str";
static char __pyx_k__hypergraph[] = "hypergraph";
+static char __pyx_k__set_silent[] = "set_silent";
static char __pyx_k__startswith[] = "startswith";
static char __pyx_k__ParseFailed[] = "ParseFailed";
static char __pyx_k__PhraseModel_[] = "PhraseModel_";
@@ -2075,6 +2180,7 @@ static PyObject *__pyx_n_s__score;
static PyObject *__pyx_n_s__scores;
static PyObject *__pyx_n_s__self;
static PyObject *__pyx_n_s__sentence;
+static PyObject *__pyx_n_s__set_silent;
static PyObject *__pyx_n_s__span;
static PyObject *__pyx_n_s__split;
static PyObject *__pyx_n_s__startswith;
@@ -2084,6 +2190,7 @@ static PyObject *__pyx_n_s__tagger;
static PyObject *__pyx_n_s__utf8;
static PyObject *__pyx_n_s__value;
static PyObject *__pyx_n_s__weight;
+static PyObject *__pyx_n_s__yn;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_65536;
@@ -2110,9 +2217,11 @@ static PyObject *__pyx_k_tuple_59;
static PyObject *__pyx_k_tuple_60;
static PyObject *__pyx_k_tuple_61;
static PyObject *__pyx_k_tuple_62;
+static PyObject *__pyx_k_tuple_65;
static PyObject *__pyx_k_codeobj_37;
static PyObject *__pyx_k_codeobj_57;
static PyObject *__pyx_k_codeobj_63;
+static PyObject *__pyx_k_codeobj_66;
/* "_cdec.pyx":6
* cimport decoder
@@ -2274,7 +2383,7 @@ static int __pyx_pw_5_cdec_11DenseVector_1__init__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":7
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":7
* cdef bint owned # if True, do not manage memory
*
* def __init__(self): # <<<<<<<<<<<<<<
@@ -2287,7 +2396,7 @@ static int __pyx_pf_5_cdec_11DenseVector___init__(struct __pyx_obj_5_cdec_DenseV
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":8
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":8
*
* def __init__(self):
* self.vector = new vector[weight_t]() # <<<<<<<<<<<<<<
@@ -2296,7 +2405,7 @@ static int __pyx_pf_5_cdec_11DenseVector___init__(struct __pyx_obj_5_cdec_DenseV
*/
__pyx_v_self->vector = new std::vector<weight_t>();
- /* "/home/cdyer/cdec/python/src/vectors.pxi":9
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":9
* def __init__(self):
* self.vector = new vector[weight_t]()
* self.owned = False # <<<<<<<<<<<<<<
@@ -2319,7 +2428,7 @@ static void __pyx_pw_5_cdec_11DenseVector_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":11
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":11
* self.owned = False
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -2332,7 +2441,7 @@ static void __pyx_pf_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_5_cdec_D
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":12
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":12
*
* def __dealloc__(self):
* if not self.owned: # <<<<<<<<<<<<<<
@@ -2342,7 +2451,7 @@ static void __pyx_pf_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_5_cdec_D
__pyx_t_1 = (!__pyx_v_self->owned);
if (__pyx_t_1) {
- /* "/home/cdyer/cdec/python/src/vectors.pxi":13
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":13
* def __dealloc__(self):
* if not self.owned:
* del self.vector # <<<<<<<<<<<<<<
@@ -2368,7 +2477,7 @@ static Py_ssize_t __pyx_pw_5_cdec_11DenseVector_5__len__(PyObject *__pyx_v_self)
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":15
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":15
* del self.vector
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -2381,7 +2490,7 @@ static Py_ssize_t __pyx_pf_5_cdec_11DenseVector_4__len__(struct __pyx_obj_5_cdec
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":16
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":16
*
* def __len__(self):
* return self.vector.size() # <<<<<<<<<<<<<<
@@ -2418,7 +2527,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_7__getitem__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":18
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":18
* return self.vector.size()
*
* def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
@@ -2438,7 +2547,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":19
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":19
*
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -2447,7 +2556,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":20
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":20
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname)
* if 0 <= fid < self.vector.size(): # <<<<<<<<<<<<<<
@@ -2460,7 +2569,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c
}
if (__pyx_t_1) {
- /* "/home/cdyer/cdec/python/src/vectors.pxi":21
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":21
* cdef int fid = FDConvert(fname)
* if 0 <= fid < self.vector.size():
* return self.vector[0][fid] # <<<<<<<<<<<<<<
@@ -2477,7 +2586,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":22
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":22
* if 0 <= fid < self.vector.size():
* return self.vector[0][fid]
* raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -2536,7 +2645,7 @@ static int __pyx_pw_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":24
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":24
* raise KeyError(fname)
*
* def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
@@ -2556,7 +2665,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":25
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":25
*
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(<char *>fname) # <<<<<<<<<<<<<<
@@ -2565,7 +2674,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De
*/
__pyx_v_fid = FD::Convert(((char *)__pyx_v_fname));
- /* "/home/cdyer/cdec/python/src/vectors.pxi":26
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":26
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(<char *>fname)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -2591,7 +2700,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":27
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":27
* cdef int fid = FDConvert(<char *>fname)
* if fid < 0: raise KeyError(fname)
* if self.vector.size() <= fid: # <<<<<<<<<<<<<<
@@ -2601,7 +2710,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De
__pyx_t_1 = (__pyx_v_self->vector->size() <= __pyx_v_fid);
if (__pyx_t_1) {
- /* "/home/cdyer/cdec/python/src/vectors.pxi":28
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":28
* if fid < 0: raise KeyError(fname)
* if self.vector.size() <= fid:
* self.vector.resize(fid + 1) # <<<<<<<<<<<<<<
@@ -2613,7 +2722,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De
}
__pyx_L4:;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":29
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":29
* if self.vector.size() <= fid:
* self.vector.resize(fid + 1)
* self.vector[0][fid] = value # <<<<<<<<<<<<<<
@@ -2646,7 +2755,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_11__iter__(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":31
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":31
* self.vector[0][fid] = value
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -2711,7 +2820,7 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/vectors.pxi":33
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":33
* def __iter__(self):
* cdef unsigned fid
* for fid in range(1, self.vector.size()): # <<<<<<<<<<<<<<
@@ -2722,7 +2831,7 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject
for (__pyx_t_2 = 1; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_fid = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":34
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":34
* cdef unsigned fid
* for fid in range(1, self.vector.size()):
* yield FDConvert(fid).c_str(), self.vector[0][fid] # <<<<<<<<<<<<<<
@@ -2765,6 +2874,7 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -2785,7 +2895,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_self, PyO
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":36
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":36
* yield FDConvert(fid).c_str(), self.vector[0][fid]
*
* def dot(self, SparseVector other): # <<<<<<<<<<<<<<
@@ -2804,7 +2914,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_13dot(struct __pyx_obj_5_cdec_Den
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("dot", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":37
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":37
*
* def dot(self, SparseVector other):
* return other.dot(self) # <<<<<<<<<<<<<<
@@ -2852,7 +2962,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_16tosparse(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":39
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":39
* return other.dot(self)
*
* def tosparse(self): # <<<<<<<<<<<<<<
@@ -2870,7 +2980,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("tosparse", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":40
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":40
*
* def tosparse(self):
* cdef SparseVector sparse = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
@@ -2883,7 +2993,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde
__pyx_v_sparse = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":41
* def tosparse(self):
* cdef SparseVector sparse = SparseVector.__new__(SparseVector)
* sparse.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<<
@@ -2892,7 +3002,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde
*/
__pyx_v_sparse->vector = new FastSparseVector<weight_t>();
- /* "/home/cdyer/cdec/python/src/vectors.pxi":42
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":42
* cdef SparseVector sparse = SparseVector.__new__(SparseVector)
* sparse.vector = new FastSparseVector[weight_t]()
* InitSparseVector(self.vector[0], sparse.vector) # <<<<<<<<<<<<<<
@@ -2901,7 +3011,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde
*/
Weights::InitSparseVector((__pyx_v_self->vector[0]), __pyx_v_sparse->vector);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":43
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":43
* sparse.vector = new FastSparseVector[weight_t]()
* InitSparseVector(self.vector[0], sparse.vector)
* return sparse # <<<<<<<<<<<<<<
@@ -2940,7 +3050,7 @@ static int __pyx_pw_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self, PyOb
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":48
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":48
* cdef FastSparseVector[weight_t]* vector
*
* def __init__(self): # <<<<<<<<<<<<<<
@@ -2953,7 +3063,7 @@ static int __pyx_pf_5_cdec_12SparseVector___init__(struct __pyx_obj_5_cdec_Spars
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":49
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":49
*
* def __init__(self):
* self.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<<
@@ -2976,7 +3086,7 @@ static void __pyx_pw_5_cdec_12SparseVector_3__dealloc__(PyObject *__pyx_v_self)
__Pyx_RefNannyFinishContext();
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":51
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":51
* self.vector = new FastSparseVector[weight_t]()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -2988,7 +3098,7 @@ static void __pyx_pf_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED struct __p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":52
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":52
*
* def __dealloc__(self):
* del self.vector # <<<<<<<<<<<<<<
@@ -3011,7 +3121,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_5copy(PyObject *__pyx_v_self, CY
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":54
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":54
* del self.vector
*
* def copy(self): # <<<<<<<<<<<<<<
@@ -3028,7 +3138,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_4copy(struct __pyx_obj_5_cdec_Sp
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("copy", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":55
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":55
*
* def copy(self):
* return self * 1 # <<<<<<<<<<<<<<
@@ -3075,7 +3185,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_7__getitem__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":57
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":57
* return self * 1
*
* def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
@@ -3095,7 +3205,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":58
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":58
*
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -3104,7 +3214,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":59
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -3130,7 +3240,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":60
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":60
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname)
* return self.vector.value(fid) # <<<<<<<<<<<<<<
@@ -3182,7 +3292,7 @@ static int __pyx_pw_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_self, P
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":62
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":62
* return self.vector.value(fid)
*
* def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
@@ -3202,7 +3312,7 @@ static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_S
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":63
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":63
*
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(<char *>fname) # <<<<<<<<<<<<<<
@@ -3211,7 +3321,7 @@ static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_S
*/
__pyx_v_fid = FD::Convert(((char *)__pyx_v_fname));
- /* "/home/cdyer/cdec/python/src/vectors.pxi":64
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":64
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(<char *>fname)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -3237,7 +3347,7 @@ static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_S
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":65
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":65
* cdef int fid = FDConvert(<char *>fname)
* if fid < 0: raise KeyError(fname)
* self.vector.set_value(fid, value) # <<<<<<<<<<<<<<
@@ -3270,7 +3380,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_11__iter__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":67
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":67
* self.vector.set_value(fid, value)
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -3335,7 +3445,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/vectors.pxi":68
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":68
*
* def __iter__(self):
* cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False) # <<<<<<<<<<<<<<
@@ -3344,7 +3454,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
*/
__pyx_cur_scope->__pyx_v_it = new FastSparseVector<weight_t>::const_iterator((__pyx_cur_scope->__pyx_v_self->vector[0]), 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":70
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":70
* cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
* cdef unsigned i
* try: # <<<<<<<<<<<<<<
@@ -3353,7 +3463,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
*/
/*try:*/ {
- /* "/home/cdyer/cdec/python/src/vectors.pxi":71
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":71
* cdef unsigned i
* try:
* for i in range(self.vector.size()): # <<<<<<<<<<<<<<
@@ -3364,7 +3474,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":72
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":72
* try:
* for i in range(self.vector.size()):
* yield (FDConvert(it[0].ptr().first).c_str(), it[0].ptr().second) # <<<<<<<<<<<<<<
@@ -3397,7 +3507,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L5;}
- /* "/home/cdyer/cdec/python/src/vectors.pxi":73
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":73
* for i in range(self.vector.size()):
* yield (FDConvert(it[0].ptr().first).c_str(), it[0].ptr().second)
* pinc(it[0]) # ++it # <<<<<<<<<<<<<<
@@ -3408,7 +3518,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
}
}
- /* "/home/cdyer/cdec/python/src/vectors.pxi":75
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":75
* pinc(it[0]) # ++it
* finally:
* del it # <<<<<<<<<<<<<<
@@ -3453,6 +3563,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -3468,7 +3579,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":77
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":77
* del it
*
* def dot(self, other): # <<<<<<<<<<<<<<
@@ -3487,7 +3598,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("dot", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":78
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":78
*
* def dot(self, other):
* if isinstance(other, DenseVector): # <<<<<<<<<<<<<<
@@ -3500,7 +3611,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/home/cdyer/cdec/python/src/vectors.pxi":79
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":79
* def dot(self, other):
* if isinstance(other, DenseVector):
* return self.vector.dot((<DenseVector> other).vector[0]) # <<<<<<<<<<<<<<
@@ -3516,7 +3627,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp
goto __pyx_L3;
}
- /* "/home/cdyer/cdec/python/src/vectors.pxi":80
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":80
* if isinstance(other, DenseVector):
* return self.vector.dot((<DenseVector> other).vector[0])
* elif isinstance(other, SparseVector): # <<<<<<<<<<<<<<
@@ -3529,7 +3640,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/home/cdyer/cdec/python/src/vectors.pxi":81
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":81
* return self.vector.dot((<DenseVector> other).vector[0])
* elif isinstance(other, SparseVector):
* return self.vector.dot((<SparseVector> other).vector[0]) # <<<<<<<<<<<<<<
@@ -3546,7 +3657,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":82
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":82
* elif isinstance(other, SparseVector):
* return self.vector.dot((<SparseVector> other).vector[0])
* raise TypeError('cannot take the dot product of %s and SparseVector' % type(other)) # <<<<<<<<<<<<<<
@@ -3597,7 +3708,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_16__richcmp__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":84
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":84
* raise TypeError('cannot take the dot product of %s and SparseVector' % type(other))
*
* def __richcmp__(SparseVector x, SparseVector y, int op): # <<<<<<<<<<<<<<
@@ -3615,7 +3726,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":87
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":87
* if op == 2: # ==
* return x.vector[0] == y.vector[0]
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -3624,7 +3735,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5
*/
switch (__pyx_v_op) {
- /* "/home/cdyer/cdec/python/src/vectors.pxi":85
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":85
*
* def __richcmp__(SparseVector x, SparseVector y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -3633,7 +3744,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5
*/
case 2:
- /* "/home/cdyer/cdec/python/src/vectors.pxi":86
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":86
* def __richcmp__(SparseVector x, SparseVector y, int op):
* if op == 2: # ==
* return x.vector[0] == y.vector[0] # <<<<<<<<<<<<<<
@@ -3648,7 +3759,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5
goto __pyx_L0;
break;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":87
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":87
* if op == 2: # ==
* return x.vector[0] == y.vector[0]
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -3657,7 +3768,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5
*/
case 3:
- /* "/home/cdyer/cdec/python/src/vectors.pxi":88
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":88
* return x.vector[0] == y.vector[0]
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
@@ -3677,7 +3788,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5
break;
}
- /* "/home/cdyer/cdec/python/src/vectors.pxi":89
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":89
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<<
@@ -3713,7 +3824,7 @@ static Py_ssize_t __pyx_pw_5_cdec_12SparseVector_18__len__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":91
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":91
* raise NotImplemented('comparison not implemented for SparseVector')
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -3726,7 +3837,7 @@ static Py_ssize_t __pyx_pf_5_cdec_12SparseVector_17__len__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":92
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":92
*
* def __len__(self):
* return self.vector.size() # <<<<<<<<<<<<<<
@@ -3763,7 +3874,7 @@ static int __pyx_pw_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":94
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":94
* return self.vector.size()
*
* def __contains__(self, char* fname): # <<<<<<<<<<<<<<
@@ -3776,7 +3887,7 @@ static int __pyx_pf_5_cdec_12SparseVector_19__contains__(struct __pyx_obj_5_cdec
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__contains__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":95
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":95
*
* def __contains__(self, char* fname):
* return self.vector.nonzero(FDConvert(fname)) # <<<<<<<<<<<<<<
@@ -3803,7 +3914,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_22__neg__(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":97
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":97
* return self.vector.nonzero(FDConvert(fname))
*
* def __neg__(self): # <<<<<<<<<<<<<<
@@ -3821,7 +3932,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__neg__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":98
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":98
*
* def __neg__(self):
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
@@ -3834,7 +3945,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde
__pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":99
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":99
* def __neg__(self):
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](self.vector[0]) # <<<<<<<<<<<<<<
@@ -3843,7 +3954,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde
*/
__pyx_v_result->vector = new FastSparseVector<weight_t>((__pyx_v_self->vector[0]));
- /* "/home/cdyer/cdec/python/src/vectors.pxi":100
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":100
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](self.vector[0])
* result.vector[0] *= -1.0 # <<<<<<<<<<<<<<
@@ -3852,7 +3963,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde
*/
(__pyx_v_result->vector[0]) *= -1.0;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":101
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":101
* result.vector = new FastSparseVector[weight_t](self.vector[0])
* result.vector[0] *= -1.0
* return result # <<<<<<<<<<<<<<
@@ -3893,7 +4004,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":103
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":103
* return result
*
* def __iadd__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
@@ -3906,7 +4017,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_23__iadd__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iadd__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":104
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":104
*
* def __iadd__(SparseVector self, SparseVector other):
* self.vector[0] += other.vector[0] # <<<<<<<<<<<<<<
@@ -3915,7 +4026,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_23__iadd__(struct __pyx_obj_5_cd
*/
(__pyx_v_self->vector[0]) += (__pyx_v_other->vector[0]);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":105
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":105
* def __iadd__(SparseVector self, SparseVector other):
* self.vector[0] += other.vector[0]
* return self # <<<<<<<<<<<<<<
@@ -3950,7 +4061,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_26__isub__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":107
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":107
* return self
*
* def __isub__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
@@ -3963,7 +4074,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_25__isub__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__isub__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":108
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":108
*
* def __isub__(SparseVector self, SparseVector other):
* self.vector[0] -= other.vector[0] # <<<<<<<<<<<<<<
@@ -3972,7 +4083,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_25__isub__(struct __pyx_obj_5_cd
*/
(__pyx_v_self->vector[0]) -= (__pyx_v_other->vector[0]);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":109
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":109
* def __isub__(SparseVector self, SparseVector other):
* self.vector[0] -= other.vector[0]
* return self # <<<<<<<<<<<<<<
@@ -4012,7 +4123,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_28__imul__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":111
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":111
* return self
*
* def __imul__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
@@ -4025,7 +4136,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__imul__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":112
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":112
*
* def __imul__(SparseVector self, float scalar):
* self.vector[0] *= scalar # <<<<<<<<<<<<<<
@@ -4034,7 +4145,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_5_cd
*/
(__pyx_v_self->vector[0]) *= __pyx_v_scalar;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":113
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":113
* def __imul__(SparseVector self, float scalar):
* self.vector[0] *= scalar
* return self # <<<<<<<<<<<<<<
@@ -4076,7 +4187,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx_v_sel
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
-/* "/home/cdyer/cdec/python/src/vectors.pxi":115
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":115
* return self
*
* def __idiv__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
@@ -4090,7 +4201,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__idiv__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":116
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":116
*
* def __idiv__(SparseVector self, float scalar):
* self.vector[0] /= scalar # <<<<<<<<<<<<<<
@@ -4099,7 +4210,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_5_cd
*/
(__pyx_v_self->vector[0]) /= __pyx_v_scalar;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":117
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":117
* def __idiv__(SparseVector self, float scalar):
* self.vector[0] /= scalar
* return self # <<<<<<<<<<<<<<
@@ -4136,7 +4247,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_32__add__(PyObject *__pyx_v_x, P
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":119
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":119
* return self
*
* def __add__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
@@ -4154,7 +4265,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__add__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":120
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":120
*
* def __add__(SparseVector x, SparseVector y):
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
@@ -4167,7 +4278,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cde
__pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":121
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":121
* def __add__(SparseVector x, SparseVector y):
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) # <<<<<<<<<<<<<<
@@ -4176,7 +4287,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cde
*/
__pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) + (__pyx_v_y->vector[0])));
- /* "/home/cdyer/cdec/python/src/vectors.pxi":122
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":122
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0])
* return result # <<<<<<<<<<<<<<
@@ -4218,7 +4329,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_v_x, P
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":124
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":124
* return result
*
* def __sub__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
@@ -4236,7 +4347,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__sub__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":125
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":125
*
* def __sub__(SparseVector x, SparseVector y):
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
@@ -4249,7 +4360,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cde
__pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":126
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":126
* def __sub__(SparseVector x, SparseVector y):
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) # <<<<<<<<<<<<<<
@@ -4258,7 +4369,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cde
*/
__pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) - (__pyx_v_y->vector[0])));
- /* "/home/cdyer/cdec/python/src/vectors.pxi":127
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":127
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0])
* return result # <<<<<<<<<<<<<<
@@ -4294,7 +4405,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_36__mul__(PyObject *__pyx_v_x, P
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/vectors.pxi":129
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":129
* return result
*
* def __mul__(x, y): # <<<<<<<<<<<<<<
@@ -4316,7 +4427,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__mul__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":132
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":132
* cdef SparseVector vector
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<<
@@ -4339,7 +4450,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P
}
/*else*/ {
- /* "/home/cdyer/cdec/python/src/vectors.pxi":133
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":133
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x # <<<<<<<<<<<<<<
@@ -4356,7 +4467,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":134
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":134
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
@@ -4369,7 +4480,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P
__pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":135
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":135
* else: vector, scalar = y, x
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) # <<<<<<<<<<<<<<
@@ -4378,7 +4489,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P
*/
__pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) * __pyx_v_scalar));
- /* "/home/cdyer/cdec/python/src/vectors.pxi":136
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":136
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar)
* return result # <<<<<<<<<<<<<<
@@ -4417,7 +4528,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_38__div__(PyObject *__pyx_v_x, P
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
-/* "/home/cdyer/cdec/python/src/vectors.pxi":138
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":138
* return result
*
* def __div__(x, y): # <<<<<<<<<<<<<<
@@ -4440,7 +4551,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__div__", 0);
- /* "/home/cdyer/cdec/python/src/vectors.pxi":141
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":141
* cdef SparseVector vector
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<<
@@ -4463,7 +4574,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P
}
/*else*/ {
- /* "/home/cdyer/cdec/python/src/vectors.pxi":142
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":142
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x # <<<<<<<<<<<<<<
@@ -4480,7 +4591,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":143
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":143
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
@@ -4493,7 +4604,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P
__pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/vectors.pxi":144
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":144
* else: vector, scalar = y, x
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) # <<<<<<<<<<<<<<
@@ -4501,7 +4612,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P
*/
__pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) / __pyx_v_scalar));
- /* "/home/cdyer/cdec/python/src/vectors.pxi":145
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":145
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar)
* return result # <<<<<<<<<<<<<<
@@ -4533,14 +4644,13 @@ static PyObject *__pyx_pw_5_cdec_1_phrase(PyObject *__pyx_self, PyObject *__pyx_
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_phrase (wrapper)", 0);
- __pyx_self = __pyx_self;
__pyx_r = __pyx_pf_5_cdec__phrase(__pyx_self, ((PyObject *)__pyx_v_phrase));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/home/cdyer/cdec/python/src/grammar.pxi":6
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
@@ -4618,10 +4728,18 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__
for (;;) {
if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -4693,11 +4811,12 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":5
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
@@ -4726,7 +4845,7 @@ static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyO
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":6
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
@@ -4771,11 +4890,11 @@ static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx
static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
char *__pyx_v_cat;
unsigned int __pyx_v_ref;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__cat,&__pyx_n_s__ref,0};
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__cat,&__pyx_n_s__ref,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -4789,8 +4908,7 @@ static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cat);
- if (likely(values[0])) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cat)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
@@ -4801,10 +4919,6 @@ static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
- if (values[1]) {
- } else {
- __pyx_v_ref = ((unsigned int)0);
- }
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -4833,7 +4947,7 @@ static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":11
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":11
* cdef public bytes cat
* cdef public unsigned ref
* def __init__(self, char* cat, unsigned ref=0): # <<<<<<<<<<<<<<
@@ -4850,7 +4964,7 @@ static int __pyx_pf_5_cdec_2NT___init__(struct __pyx_obj_5_cdec_NT *__pyx_v_self
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":12
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":12
* cdef public unsigned ref
* def __init__(self, char* cat, unsigned ref=0):
* self.cat = cat # <<<<<<<<<<<<<<
@@ -4865,7 +4979,7 @@ static int __pyx_pf_5_cdec_2NT___init__(struct __pyx_obj_5_cdec_NT *__pyx_v_self
__pyx_v_self->cat = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":13
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":13
* def __init__(self, char* cat, unsigned ref=0):
* self.cat = cat
* self.ref = ref # <<<<<<<<<<<<<<
@@ -4896,7 +5010,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3__str__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":15
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":15
* self.ref = ref
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -4915,7 +5029,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":16
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":16
*
* def __str__(self):
* if self.ref > 0: # <<<<<<<<<<<<<<
@@ -4925,7 +5039,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_
__pyx_t_1 = (__pyx_v_self->ref > 0);
if (__pyx_t_1) {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":17
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":17
* def __str__(self):
* if self.ref > 0:
* return '[%s,%d]' % (self.cat, self.ref) # <<<<<<<<<<<<<<
@@ -4953,7 +5067,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":18
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":18
* if self.ref > 0:
* return '[%s,%d]' % (self.cat, self.ref)
* return '[%s]' % self.cat # <<<<<<<<<<<<<<
@@ -4991,7 +5105,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":9
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":9
*
* cdef class NT:
* cdef public bytes cat # <<<<<<<<<<<<<<
@@ -5087,7 +5201,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":10
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":10
* cdef class NT:
* cdef public bytes cat
* cdef public unsigned ref # <<<<<<<<<<<<<<
@@ -5158,11 +5272,11 @@ static int __pyx_pf_5_cdec_2NT_3ref_2__set__(struct __pyx_obj_5_cdec_NT *__pyx_v
static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
unsigned int __pyx_v_ref;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ref,0};
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ref,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -5175,8 +5289,7 @@ static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref);
- if (likely(values[0])) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
@@ -5202,7 +5315,7 @@ static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":22
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":22
* cdef class NTRef:
* cdef public unsigned ref
* def __init__(self, unsigned ref): # <<<<<<<<<<<<<<
@@ -5215,7 +5328,7 @@ static int __pyx_pf_5_cdec_5NTRef___init__(struct __pyx_obj_5_cdec_NTRef *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":23
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":23
* cdef public unsigned ref
* def __init__(self, unsigned ref):
* self.ref = ref # <<<<<<<<<<<<<<
@@ -5240,7 +5353,7 @@ static PyObject *__pyx_pw_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":25
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":25
* self.ref = ref
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -5258,7 +5371,7 @@ static PyObject *__pyx_pf_5_cdec_5NTRef_2__str__(struct __pyx_obj_5_cdec_NTRef *
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":26
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":26
*
* def __str__(self):
* return '[%d]' % self.ref # <<<<<<<<<<<<<<
@@ -5299,7 +5412,7 @@ static PyObject *__pyx_pw_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":21
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":21
*
* cdef class NTRef:
* cdef public unsigned ref # <<<<<<<<<<<<<<
@@ -5366,7 +5479,7 @@ static int __pyx_pf_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_5_cdec_NTRef *_
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":28
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":28
* return '[%d]' % self.ref
*
* cdef TRule convert_rule(_sa.Rule rule): # <<<<<<<<<<<<<<
@@ -5402,7 +5515,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("convert_rule", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":30
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":30
* cdef TRule convert_rule(_sa.Rule rule):
* cdef unsigned i
* cdef lhs = _sa.sym_tocat(rule.lhs) # <<<<<<<<<<<<<<
@@ -5414,7 +5527,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_v_lhs = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":31
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":31
* cdef unsigned i
* cdef lhs = _sa.sym_tocat(rule.lhs)
* cdef scores = {} # <<<<<<<<<<<<<<
@@ -5426,7 +5539,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_v_scores = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":32
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":32
* cdef lhs = _sa.sym_tocat(rule.lhs)
* cdef scores = {}
* for i in range(rule.n_scores): # <<<<<<<<<<<<<<
@@ -5437,7 +5550,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":33
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":33
* cdef scores = {}
* for i in range(rule.n_scores):
* scores['PhraseModel_'+str(i)] = rule.cscores[i] # <<<<<<<<<<<<<<
@@ -5464,7 +5577,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- /* "/home/cdyer/cdec/python/src/grammar.pxi":34
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":34
* for i in range(rule.n_scores):
* scores['PhraseModel_'+str(i)] = rule.cscores[i]
* f, e = [], [] # <<<<<<<<<<<<<<
@@ -5480,7 +5593,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_v_e = __pyx_t_5;
__pyx_t_5 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":35
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":35
* scores['PhraseModel_'+str(i)] = rule.cscores[i]
* f, e = [], []
* cdef int* fsyms = rule.f.syms # <<<<<<<<<<<<<<
@@ -5489,7 +5602,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
*/
__pyx_v_fsyms = __pyx_v_rule->f->syms;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":36
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":36
* f, e = [], []
* cdef int* fsyms = rule.f.syms
* for i in range(rule.f.n): # <<<<<<<<<<<<<<
@@ -5500,7 +5613,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":37
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":37
* cdef int* fsyms = rule.f.syms
* for i in range(rule.f.n):
* if _sa.sym_isvar(fsyms[i]): # <<<<<<<<<<<<<<
@@ -5510,7 +5623,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_t_6 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_fsyms[__pyx_v_i]));
if (__pyx_t_6) {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":38
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":38
* for i in range(rule.f.n):
* if _sa.sym_isvar(fsyms[i]):
* f.append(NT(_sa.sym_tocat(fsyms[i]))) # <<<<<<<<<<<<<<
@@ -5533,7 +5646,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
}
/*else*/ {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":40
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":40
* f.append(NT(_sa.sym_tocat(fsyms[i])))
* else:
* f.append(_sa.sym_tostring(fsyms[i])) # <<<<<<<<<<<<<<
@@ -5548,7 +5661,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_L7:;
}
- /* "/home/cdyer/cdec/python/src/grammar.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":41
* else:
* f.append(_sa.sym_tostring(fsyms[i]))
* cdef int* esyms = rule.e.syms # <<<<<<<<<<<<<<
@@ -5557,7 +5670,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
*/
__pyx_v_esyms = __pyx_v_rule->e->syms;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":42
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":42
* f.append(_sa.sym_tostring(fsyms[i]))
* cdef int* esyms = rule.e.syms
* for i in range(rule.e.n): # <<<<<<<<<<<<<<
@@ -5568,7 +5681,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":43
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":43
* cdef int* esyms = rule.e.syms
* for i in range(rule.e.n):
* if _sa.sym_isvar(esyms[i]): # <<<<<<<<<<<<<<
@@ -5578,7 +5691,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_t_6 = __pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_esyms[__pyx_v_i]));
if (__pyx_t_6) {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":44
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":44
* for i in range(rule.e.n):
* if _sa.sym_isvar(esyms[i]):
* e.append(NTRef(_sa.sym_getindex(esyms[i]))) # <<<<<<<<<<<<<<
@@ -5601,7 +5714,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
}
/*else*/ {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":46
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":46
* e.append(NTRef(_sa.sym_getindex(esyms[i])))
* else:
* e.append(_sa.sym_tostring(esyms[i])) # <<<<<<<<<<<<<<
@@ -5616,7 +5729,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_L10:;
}
- /* "/home/cdyer/cdec/python/src/grammar.pxi":47
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":47
* else:
* e.append(_sa.sym_tostring(esyms[i]))
* cdef a = [(point/65536, point%65536) for point in rule.word_alignments] # <<<<<<<<<<<<<<
@@ -5636,10 +5749,18 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
for (;;) {
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_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++;
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_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_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++;
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_4 = __pyx_t_9(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -5666,7 +5787,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__Pyx_GIVEREF(__pyx_t_10);
__pyx_t_4 = 0;
__pyx_t_10 = 0;
- if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_11))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_11))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -5674,7 +5795,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o
__pyx_v_a = ((PyObject *)__pyx_t_5);
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":48
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":48
* e.append(_sa.sym_tostring(esyms[i]))
* cdef a = [(point/65536, point%65536) for point in rule.word_alignments]
* return TRule(lhs, f, e, scores, a) # <<<<<<<<<<<<<<
@@ -5736,14 +5857,14 @@ static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__
PyObject *__pyx_v_e = 0;
PyObject *__pyx_v_scores = 0;
PyObject *__pyx_v_a = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__scores,&__pyx_n_s__a,0};
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__scores,&__pyx_n_s__a,0};
PyObject* values[5] = {0,0,0,0,0};
- /* "/home/cdyer/cdec/python/src/grammar.pxi":53
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":53
* cdef shared_ptr[grammar.TRule]* rule
*
* def __init__(self, lhs, f, e, scores, a=None): # <<<<<<<<<<<<<<
@@ -5766,24 +5887,20 @@ static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs);
- if (likely(values[0])) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f);
- if (likely(values[1])) kw_args--;
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e);
- if (likely(values[2])) kw_args--;
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
- values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores);
- if (likely(values[3])) kw_args--;
+ if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
@@ -5829,22 +5946,24 @@ static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__
static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_lhs, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_scores, PyObject *__pyx_v_a) {
int __pyx_r;
__Pyx_RefNannyDeclarations
- int __pyx_t_1;
+ TRule *__pyx_t_1;
+ int __pyx_t_2;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":54
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":54
*
* def __init__(self, lhs, f, e, scores, a=None):
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) # <<<<<<<<<<<<<<
* self.lhs = lhs
* self.e = e
*/
- __pyx_v_self->rule = new boost::shared_ptr<TRule>(new TRule());
+ try {__pyx_t_1 = new TRule();} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+ __pyx_v_self->rule = new boost::shared_ptr<TRule>(__pyx_t_1);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":55
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":55
* def __init__(self, lhs, f, e, scores, a=None):
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule())
* self.lhs = lhs # <<<<<<<<<<<<<<
@@ -5853,7 +5972,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_
*/
if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__lhs, __pyx_v_lhs) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/grammar.pxi":56
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":56
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule())
* self.lhs = lhs
* self.e = e # <<<<<<<<<<<<<<
@@ -5862,7 +5981,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_
*/
if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__e, __pyx_v_e) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/grammar.pxi":57
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":57
* self.lhs = lhs
* self.e = e
* self.f = f # <<<<<<<<<<<<<<
@@ -5871,7 +5990,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_
*/
if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__f, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/grammar.pxi":58
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":58
* self.e = e
* self.f = f
* self.scores = scores # <<<<<<<<<<<<<<
@@ -5880,17 +5999,17 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_
*/
if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__scores, __pyx_v_scores) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/grammar.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":59
* self.f = f
* self.scores = scores
* if a: # <<<<<<<<<<<<<<
* self.a = a
* self.rule.get().ComputeArity()
*/
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_1) {
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_2) {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":60
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":60
* self.scores = scores
* if a:
* self.a = a # <<<<<<<<<<<<<<
@@ -5902,7 +6021,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":61
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":61
* if a:
* self.a = a
* self.rule.get().ComputeArity() # <<<<<<<<<<<<<<
@@ -5930,7 +6049,7 @@ static void __pyx_pw_5_cdec_5TRule_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":63
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":63
* self.rule.get().ComputeArity()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -5942,7 +6061,7 @@ static void __pyx_pf_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":64
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":64
*
* def __dealloc__(self):
* del self.rule # <<<<<<<<<<<<<<
@@ -5965,7 +6084,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self)
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":67
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":67
*
* property arity:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -5982,7 +6101,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_5arity___get__(struct __pyx_obj_5_cdec_T
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":68
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":68
* property arity:
* def __get__(self):
* return self.rule.get().arity_ # <<<<<<<<<<<<<<
@@ -6019,7 +6138,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":71
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":71
*
* property f:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -6046,7 +6165,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":72
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":72
* property f:
* def __get__(self):
* cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<<
@@ -6055,7 +6174,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_f_ = (&__pyx_v_self->rule->get()->f_);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":74
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":74
* cdef vector[WordID]* f_ = &self.rule.get().f_
* cdef WordID w
* cdef f = [] # <<<<<<<<<<<<<<
@@ -6067,7 +6186,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
__pyx_v_f = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":76
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":76
* cdef f = []
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6076,7 +6195,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_idx = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":77
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":77
* cdef unsigned i
* cdef int idx = 0
* for i in range(f_.size()): # <<<<<<<<<<<<<<
@@ -6087,7 +6206,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":78
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":78
* cdef int idx = 0
* for i in range(f_.size()):
* w = f_[0][i] # <<<<<<<<<<<<<<
@@ -6096,7 +6215,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_w = ((__pyx_v_f_[0])[__pyx_v_i]);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":79
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":79
* for i in range(f_.size()):
* w = f_[0][i]
* if w < 0: # <<<<<<<<<<<<<<
@@ -6106,7 +6225,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
__pyx_t_4 = (__pyx_v_w < 0);
if (__pyx_t_4) {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":80
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":80
* w = f_[0][i]
* if w < 0:
* idx += 1 # <<<<<<<<<<<<<<
@@ -6115,7 +6234,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_idx = (__pyx_v_idx + 1);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":81
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":81
* if w < 0:
* idx += 1
* f.append(NT(TDConvert(-w), idx)) # <<<<<<<<<<<<<<
@@ -6145,7 +6264,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
}
/*else*/ {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":83
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":83
* f.append(NT(TDConvert(-w), idx))
* else:
* f.append(unicode(TDConvert(w), encoding='utf8')) # <<<<<<<<<<<<<<
@@ -6174,7 +6293,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule
__pyx_L5:;
}
- /* "/home/cdyer/cdec/python/src/grammar.pxi":84
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":84
* else:
* f.append(unicode(TDConvert(w), encoding='utf8'))
* return f # <<<<<<<<<<<<<<
@@ -6212,7 +6331,7 @@ static int __pyx_pw_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":86
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":86
* return f
*
* def __set__(self, f): # <<<<<<<<<<<<<<
@@ -6237,7 +6356,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":87
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":87
*
* def __set__(self, f):
* cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<<
@@ -6246,7 +6365,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
*/
__pyx_v_f_ = (&__pyx_v_self->rule->get()->f_);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":88
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":88
* def __set__(self, f):
* cdef vector[WordID]* f_ = &self.rule.get().f_
* f_.resize(len(f)) # <<<<<<<<<<<<<<
@@ -6256,7 +6375,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
__pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_f_->resize(__pyx_t_1);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":90
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":90
* f_.resize(len(f))
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6265,7 +6384,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
*/
__pyx_v_idx = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":91
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":91
* cdef unsigned i
* cdef int idx = 0
* for i in range(len(f)): # <<<<<<<<<<<<<<
@@ -6276,7 +6395,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":92
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":92
* cdef int idx = 0
* for i in range(len(f)):
* if isinstance(f[i], NT): # <<<<<<<<<<<<<<
@@ -6292,7 +6411,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_5) {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":93
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":93
* for i in range(len(f)):
* if isinstance(f[i], NT):
* f_[0][i] = -TDConvert(<char *>f[i].cat) # <<<<<<<<<<<<<<
@@ -6311,7 +6430,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p
}
/*else*/ {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":95
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":95
* f_[0][i] = -TDConvert(<char *>f[i].cat)
* else:
* f_[0][i] = TDConvert(<char *>as_str(f[i])) # <<<<<<<<<<<<<<
@@ -6349,7 +6468,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":98
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":98
*
* property e:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -6376,7 +6495,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":99
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":99
* property e:
* def __get__(self):
* cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<<
@@ -6385,7 +6504,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_e_ = (&__pyx_v_self->rule->get()->e_);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":101
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":101
* cdef vector[WordID]* e_ = &self.rule.get().e_
* cdef WordID w
* cdef e = [] # <<<<<<<<<<<<<<
@@ -6397,7 +6516,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
__pyx_v_e = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":103
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":103
* cdef e = []
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6406,7 +6525,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_idx = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":104
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":104
* cdef unsigned i
* cdef int idx = 0
* for i in range(e_.size()): # <<<<<<<<<<<<<<
@@ -6417,7 +6536,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":105
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":105
* cdef int idx = 0
* for i in range(e_.size()):
* w = e_[0][i] # <<<<<<<<<<<<<<
@@ -6426,7 +6545,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_w = ((__pyx_v_e_[0])[__pyx_v_i]);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":106
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":106
* for i in range(e_.size()):
* w = e_[0][i]
* if w < 1: # <<<<<<<<<<<<<<
@@ -6436,7 +6555,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
__pyx_t_4 = (__pyx_v_w < 1);
if (__pyx_t_4) {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":107
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":107
* w = e_[0][i]
* if w < 1:
* idx += 1 # <<<<<<<<<<<<<<
@@ -6445,7 +6564,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_idx = (__pyx_v_idx + 1);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":108
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":108
* if w < 1:
* idx += 1
* e.append(NTRef(1-w)) # <<<<<<<<<<<<<<
@@ -6470,7 +6589,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
}
/*else*/ {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":110
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":110
* e.append(NTRef(1-w))
* else:
* e.append(unicode(TDConvert(w), encoding='utf8')) # <<<<<<<<<<<<<<
@@ -6499,7 +6618,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule
__pyx_L5:;
}
- /* "/home/cdyer/cdec/python/src/grammar.pxi":111
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":111
* else:
* e.append(unicode(TDConvert(w), encoding='utf8'))
* return e # <<<<<<<<<<<<<<
@@ -6537,7 +6656,7 @@ static int __pyx_pw_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":113
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":113
* return e
*
* def __set__(self, e): # <<<<<<<<<<<<<<
@@ -6561,7 +6680,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":114
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":114
*
* def __set__(self, e):
* cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<<
@@ -6570,7 +6689,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
*/
__pyx_v_e_ = (&__pyx_v_self->rule->get()->e_);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":115
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":115
* def __set__(self, e):
* cdef vector[WordID]* e_ = &self.rule.get().e_
* e_.resize(len(e)) # <<<<<<<<<<<<<<
@@ -6580,7 +6699,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
__pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_e_->resize(__pyx_t_1);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":117
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":117
* e_.resize(len(e))
* cdef unsigned i
* for i in range(len(e)): # <<<<<<<<<<<<<<
@@ -6591,7 +6710,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":118
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":118
* cdef unsigned i
* for i in range(len(e)):
* if isinstance(e[i], NTRef): # <<<<<<<<<<<<<<
@@ -6607,7 +6726,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_5) {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":119
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":119
* for i in range(len(e)):
* if isinstance(e[i], NTRef):
* e_[0][i] = 1-e[i].ref # <<<<<<<<<<<<<<
@@ -6629,7 +6748,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p
}
/*else*/ {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":121
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":121
* e_[0][i] = 1-e[i].ref
* else:
* e_[0][i] = TDConvert(<char *>as_str(e[i])) # <<<<<<<<<<<<<<
@@ -6668,7 +6787,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":124
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":124
*
* property a:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -6733,7 +6852,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/grammar.pxi":126
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":126
* def __get__(self):
* cdef unsigned i
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ # <<<<<<<<<<<<<<
@@ -6742,7 +6861,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__
*/
__pyx_cur_scope->__pyx_v_a = (&__pyx_cur_scope->__pyx_v_self->rule->get()->a_);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":127
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":127
* cdef unsigned i
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
* for i in range(a.size()): # <<<<<<<<<<<<<<
@@ -6753,7 +6872,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":128
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":128
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
* for i in range(a.size()):
* yield (a[0][i].s_, a[0][i].t_) # <<<<<<<<<<<<<<
@@ -6796,6 +6915,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -6811,7 +6931,7 @@ static int __pyx_pw_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":130
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":130
* yield (a[0][i].s_, a[0][i].t_)
*
* def __set__(self, a): # <<<<<<<<<<<<<<
@@ -6840,7 +6960,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":131
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":131
*
* def __set__(self, a):
* cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_ # <<<<<<<<<<<<<<
@@ -6849,7 +6969,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
*/
__pyx_v_a_ = (&__pyx_v_self->rule->get()->a_);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":132
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":132
* def __set__(self, a):
* cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_
* a_.resize(len(a)) # <<<<<<<<<<<<<<
@@ -6859,7 +6979,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
__pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_a_->resize(__pyx_t_1);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":135
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":135
* cdef unsigned i
* cdef int s, t
* for i in range(len(a)): # <<<<<<<<<<<<<<
@@ -6870,7 +6990,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":136
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":136
* cdef int s, t
* for i in range(len(a)):
* s, t = a[i] # <<<<<<<<<<<<<<
@@ -6881,27 +7001,33 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
__Pyx_GOTREF(__pyx_t_3);
if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
PyObject* sequence = __pyx_t_3;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ #if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
- if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
} else {
- if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
- if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_4 = PyList_GET_ITEM(sequence, 0);
__pyx_t_5 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(__pyx_t_5);
+ #else
+ __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- } else {
+ } else
+ {
Py_ssize_t index = -1;
__pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
@@ -6912,12 +7038,13 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_5);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = NULL;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L6_unpacking_done;
__pyx_L5_unpacking_failed:;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
- if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+ __pyx_t_7 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L6_unpacking_done:;
}
@@ -6928,7 +7055,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p
__pyx_v_s = __pyx_t_8;
__pyx_v_t = __pyx_t_9;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":137
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":137
* for i in range(len(a)):
* s, t = a[i]
* a_[0][i] = grammar.AlignmentPoint(s, t) # <<<<<<<<<<<<<<
@@ -6963,7 +7090,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self)
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":140
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":140
*
* property scores:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -6981,7 +7108,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":141
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":141
* property scores:
* def __get__(self):
* cdef SparseVector scores = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
@@ -6994,7 +7121,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_
__pyx_v_scores = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":142
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":142
* def __get__(self):
* cdef SparseVector scores = SparseVector.__new__(SparseVector)
* scores.vector = new FastSparseVector[double](self.rule.get().scores_) # <<<<<<<<<<<<<<
@@ -7003,7 +7130,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_
*/
__pyx_v_scores->vector = new FastSparseVector<double>(__pyx_v_self->rule->get()->scores_);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":143
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":143
* cdef SparseVector scores = SparseVector.__new__(SparseVector)
* scores.vector = new FastSparseVector[double](self.rule.get().scores_)
* return scores # <<<<<<<<<<<<<<
@@ -7039,7 +7166,7 @@ static int __pyx_pw_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":145
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":145
* return scores
*
* def __set__(self, scores): # <<<<<<<<<<<<<<
@@ -7069,7 +7196,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":146
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":146
*
* def __set__(self, scores):
* cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_ # <<<<<<<<<<<<<<
@@ -7078,7 +7205,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_scores_ = (&__pyx_v_self->rule->get()->scores_);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":147
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":147
* def __set__(self, scores):
* cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_
* scores_.clear() # <<<<<<<<<<<<<<
@@ -7087,7 +7214,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_scores_->clear();
- /* "/home/cdyer/cdec/python/src/grammar.pxi":150
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":150
* cdef int fid
* cdef float fval
* for fname, fval in scores.items(): # <<<<<<<<<<<<<<
@@ -7111,10 +7238,18 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
for (;;) {
if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_2 = __pyx_t_4(__pyx_t_1);
if (unlikely(!__pyx_t_2)) {
@@ -7128,27 +7263,33 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
}
if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
PyObject* sequence = __pyx_t_2;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ #if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
- if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
} else {
- if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
- if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_5 = PyList_GET_ITEM(sequence, 0);
__pyx_t_6 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_6);
+ #else
+ __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- } else {
+ } else
+ {
Py_ssize_t index = -1;
__pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
@@ -7159,12 +7300,13 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L6_unpacking_done;
__pyx_L5_unpacking_failed:;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
- if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+ __pyx_t_8 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L6_unpacking_done:;
}
@@ -7175,7 +7317,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
__pyx_t_5 = 0;
__pyx_v_fval = __pyx_t_9;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":151
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":151
* cdef float fval
* for fname, fval in scores.items():
* fid = FDConvert(<char *>as_str(fname)) # <<<<<<<<<<<<<<
@@ -7184,7 +7326,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
*/
__pyx_v_fid = FD::Convert(((char *)__pyx_f_5_cdec_as_str(__pyx_v_fname, NULL)));
- /* "/home/cdyer/cdec/python/src/grammar.pxi":152
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":152
* for fname, fval in scores.items():
* fid = FDConvert(<char *>as_str(fname))
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -7208,7 +7350,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule
}
__pyx_L7:;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":153
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":153
* fid = FDConvert(<char *>as_str(fname))
* if fid < 0: raise KeyError(fname)
* scores_.set_value(fid, fval) # <<<<<<<<<<<<<<
@@ -7246,7 +7388,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":156
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":156
*
* property lhs:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -7264,7 +7406,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRu
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":157
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":157
* property lhs:
* def __get__(self):
* return NT(TDConvert(-self.rule.get().lhs_)) # <<<<<<<<<<<<<<
@@ -7310,7 +7452,7 @@ static int __pyx_pw_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":159
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":159
* return NT(TDConvert(-self.rule.get().lhs_))
*
* def __set__(self, lhs): # <<<<<<<<<<<<<<
@@ -7332,7 +7474,7 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_
__Pyx_RefNannySetupContext("__set__", 0);
__Pyx_INCREF(__pyx_v_lhs);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":160
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":160
*
* def __set__(self, lhs):
* if not isinstance(lhs, NT): # <<<<<<<<<<<<<<
@@ -7346,7 +7488,7 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_
__pyx_t_3 = (!__pyx_t_2);
if (__pyx_t_3) {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":161
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":161
* def __set__(self, lhs):
* if not isinstance(lhs, NT):
* lhs = NT(lhs) # <<<<<<<<<<<<<<
@@ -7368,7 +7510,7 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":162
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":162
* if not isinstance(lhs, NT):
* lhs = NT(lhs)
* self.rule.get().lhs_ = -TDConvert(<char *>lhs.cat) # <<<<<<<<<<<<<<
@@ -7406,7 +7548,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_5__str__(PyObject *__pyx_v_self) {
}
static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/home/cdyer/cdec/python/src/grammar.pxi":165
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":165
*
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
@@ -7484,10 +7626,18 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj
for (;;) {
if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_1 = __pyx_t_4(__pyx_t_2);
if (unlikely(!__pyx_t_1)) {
@@ -7535,11 +7685,12 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":164
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":164
* self.rule.get().lhs_ = -TDConvert(<char *>lhs.cat)
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -7571,7 +7722,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule *
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":165
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":165
*
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
@@ -7594,7 +7745,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule *
__pyx_v_scores = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":166
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":166
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores)
* return '%s ||| %s ||| %s ||| %s' % (self.lhs, # <<<<<<<<<<<<<<
@@ -7605,7 +7756,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule *
__pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":167
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":167
* scores = ' '.join('%s=%s' % feat for feat in self.scores)
* return '%s ||| %s ||| %s ||| %s' % (self.lhs,
* _phrase(self.f), _phrase(self.e), scores) # <<<<<<<<<<<<<<
@@ -7684,14 +7835,14 @@ static int __pyx_pw_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__
PyObject *__pyx_v_rhs = 0;
PyObject *__pyx_v_scores = 0;
PyObject *__pyx_v_a = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__rhs,&__pyx_n_s__scores,&__pyx_n_s__a,0};
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__rhs,&__pyx_n_s__scores,&__pyx_n_s__a,0};
PyObject* values[4] = {0,0,0,0};
- /* "/home/cdyer/cdec/python/src/grammar.pxi":170
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":170
*
* cdef class MRule(TRule):
* def __init__(self, lhs, rhs, scores, a=None): # <<<<<<<<<<<<<<
@@ -7713,18 +7864,15 @@ static int __pyx_pw_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs);
- if (likely(values[0])) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rhs);
- if (likely(values[1])) kw_args--;
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rhs)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores);
- if (likely(values[2])) kw_args--;
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
@@ -7783,7 +7931,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":171
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":171
* cdef class MRule(TRule):
* def __init__(self, lhs, rhs, scores, a=None):
* cdef unsigned i = 1 # <<<<<<<<<<<<<<
@@ -7792,7 +7940,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
*/
__pyx_v_i = 1;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":172
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":172
* def __init__(self, lhs, rhs, scores, a=None):
* cdef unsigned i = 1
* e = [] # <<<<<<<<<<<<<<
@@ -7804,7 +7952,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
__pyx_v_e = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":173
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":173
* cdef unsigned i = 1
* e = []
* for s in rhs: # <<<<<<<<<<<<<<
@@ -7822,10 +7970,18 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
for (;;) {
if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -7841,7 +7997,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
__pyx_v_s = __pyx_t_4;
__pyx_t_4 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":174
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":174
* e = []
* for s in rhs:
* if isinstance(s, NT): # <<<<<<<<<<<<<<
@@ -7854,7 +8010,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_5) {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":175
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":175
* for s in rhs:
* if isinstance(s, NT):
* e.append(NTRef(i)) # <<<<<<<<<<<<<<
@@ -7874,7 +8030,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
__pyx_t_7 = PyList_Append(__pyx_v_e, __pyx_t_4); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":176
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":176
* if isinstance(s, NT):
* e.append(NTRef(i))
* i += 1 # <<<<<<<<<<<<<<
@@ -7886,7 +8042,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
}
/*else*/ {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":178
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":178
* i += 1
* else:
* e.append(s) # <<<<<<<<<<<<<<
@@ -7899,7 +8055,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":179
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":179
* else:
* e.append(s)
* super(MRule, self).__init__(lhs, rhs, e, scores, a) # <<<<<<<<<<<<<<
@@ -7967,7 +8123,7 @@ static void __pyx_pw_5_cdec_7Grammar_1__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":184
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":184
* cdef shared_ptr[grammar.Grammar]* grammar
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -7979,7 +8135,7 @@ static void __pyx_pf_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __pyx_obj_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":185
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":185
*
* def __dealloc__(self):
* del self.grammar # <<<<<<<<<<<<<<
@@ -8003,7 +8159,7 @@ static PyObject *__pyx_pw_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":187
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":187
* del self.grammar
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -8066,7 +8222,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/grammar.pxi":188
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":188
*
* def __iter__(self):
* cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() # <<<<<<<<<<<<<<
@@ -8075,7 +8231,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
*/
__pyx_cur_scope->__pyx_v_root = __pyx_cur_scope->__pyx_v_self->grammar->get()->GetRoot();
- /* "/home/cdyer/cdec/python/src/grammar.pxi":189
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":189
* def __iter__(self):
* cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
* cdef grammar.const_RuleBin* rbin = root.GetRules() # <<<<<<<<<<<<<<
@@ -8084,7 +8240,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
*/
__pyx_cur_scope->__pyx_v_rbin = __pyx_cur_scope->__pyx_v_root->GetRules();
- /* "/home/cdyer/cdec/python/src/grammar.pxi":192
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":192
* cdef TRule trule
* cdef unsigned i
* for i in range(rbin.GetNumRules()): # <<<<<<<<<<<<<<
@@ -8095,7 +8251,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":193
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":193
* cdef unsigned i
* for i in range(rbin.GetNumRules()):
* trule = TRule.__new__(TRule) # <<<<<<<<<<<<<<
@@ -8111,7 +8267,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
__pyx_cur_scope->__pyx_v_trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":194
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":194
* for i in range(rbin.GetNumRules()):
* trule = TRule.__new__(TRule)
* trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) # <<<<<<<<<<<<<<
@@ -8120,7 +8276,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
*/
__pyx_cur_scope->__pyx_v_trule->rule = new boost::shared_ptr<TRule>(__pyx_cur_scope->__pyx_v_rbin->GetIthRule(__pyx_cur_scope->__pyx_v_i));
- /* "/home/cdyer/cdec/python/src/grammar.pxi":195
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":195
* trule = TRule.__new__(TRule)
* trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i))
* yield trule # <<<<<<<<<<<<<<
@@ -8149,6 +8305,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -8164,7 +8321,7 @@ static PyObject *__pyx_pw_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v_self)
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":198
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":198
*
* property name:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -8177,7 +8334,7 @@ static PyObject *__pyx_pf_5_cdec_7Grammar_4name___get__(struct __pyx_obj_5_cdec_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":199
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":199
* property name:
* def __get__(self):
* self.grammar.get().GetGrammarName().c_str() # <<<<<<<<<<<<<<
@@ -8203,7 +8360,7 @@ static int __pyx_pw_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":201
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":201
* self.grammar.get().GetGrammarName().c_str()
*
* def __set__(self, name): # <<<<<<<<<<<<<<
@@ -8220,7 +8377,7 @@ static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Gramm
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":202
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":202
*
* def __set__(self, name):
* self.grammar.get().SetGrammarName(string(<char *>name)) # <<<<<<<<<<<<<<
@@ -8244,11 +8401,11 @@ static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Gramm
static int __pyx_pw_5_cdec_11TextGrammar_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5_cdec_11TextGrammar_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_rules = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__rules,0};
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__rules,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -8261,8 +8418,7 @@ static int __pyx_pw_5_cdec_11TextGrammar_1__cinit__(PyObject *__pyx_v_self, PyOb
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rules);
- if (likely(values[0])) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rules)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
@@ -8288,7 +8444,7 @@ static int __pyx_pw_5_cdec_11TextGrammar_1__cinit__(PyObject *__pyx_v_self, PyOb
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/grammar.pxi":205
+/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":205
*
* cdef class TextGrammar(Grammar):
* def __cinit__(self, rules): # <<<<<<<<<<<<<<
@@ -8313,7 +8469,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/home/cdyer/cdec/python/src/grammar.pxi":206
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":206
* cdef class TextGrammar(Grammar):
* def __cinit__(self, rules):
* self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) # <<<<<<<<<<<<<<
@@ -8322,7 +8478,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
*/
__pyx_v_self->__pyx_base.grammar = new boost::shared_ptr<Grammar>(new TextGrammar());
- /* "/home/cdyer/cdec/python/src/grammar.pxi":207
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":207
* def __cinit__(self, rules):
* self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
* cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get() # <<<<<<<<<<<<<<
@@ -8331,7 +8487,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
*/
__pyx_v__g = ((TextGrammar *)__pyx_v_self->__pyx_base.grammar->get());
- /* "/home/cdyer/cdec/python/src/grammar.pxi":208
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":208
* self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
* cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get()
* for trule in rules: # <<<<<<<<<<<<<<
@@ -8349,10 +8505,18 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
for (;;) {
if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -8368,7 +8532,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
__pyx_v_trule = __pyx_t_4;
__pyx_t_4 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":209
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":209
* cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get()
* for trule in rules:
* if isinstance(trule, _sa.Rule): # <<<<<<<<<<<<<<
@@ -8381,7 +8545,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_5) {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":210
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":210
* for trule in rules:
* if isinstance(trule, _sa.Rule):
* trule = convert_rule(trule) # <<<<<<<<<<<<<<
@@ -8400,7 +8564,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
goto __pyx_L5;
}
- /* "/home/cdyer/cdec/python/src/grammar.pxi":211
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":211
* if isinstance(trule, _sa.Rule):
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule): # <<<<<<<<<<<<<<
@@ -8414,7 +8578,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
__pyx_t_7 = (!__pyx_t_5);
if (__pyx_t_7) {
- /* "/home/cdyer/cdec/python/src/grammar.pxi":212
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":212
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<<
@@ -8429,7 +8593,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___cinit__(struct __pyx_obj_5_cdec_TextG
}
__pyx_L5:;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":213
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":213
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects')
* _g.AddRule((<TRule> trule).rule[0]) # <<<<<<<<<<<<<<
@@ -8461,7 +8625,7 @@ static void __pyx_pw_5_cdec_10Hypergraph_1__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":8
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":8
* cdef MT19937* rng
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -8474,7 +8638,7 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":9
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":9
*
* def __dealloc__(self):
* del self.hg # <<<<<<<<<<<<<<
@@ -8483,7 +8647,7 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp
*/
delete __pyx_v_self->hg;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":10
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":10
* def __dealloc__(self):
* del self.hg
* if self.rng != NULL: # <<<<<<<<<<<<<<
@@ -8493,12 +8657,12 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp
__pyx_t_1 = (__pyx_v_self->rng != NULL);
if (__pyx_t_1) {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":11
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":11
* del self.hg
* if self.rng != NULL:
* del self.rng # <<<<<<<<<<<<<<
*
- * def viterbi(self):
+ * cdef MT19937* _rng(self):
*/
delete __pyx_v_self->rng;
goto __pyx_L3;
@@ -8508,6 +8672,67 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp
__Pyx_RefNannyFinishContext();
}
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":13
+ * del self.rng
+ *
+ * cdef MT19937* _rng(self): # <<<<<<<<<<<<<<
+ * if self.rng == NULL:
+ * self.rng = new MT19937()
+ */
+
+static MT19937 *__pyx_f_5_cdec_10Hypergraph__rng(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
+ MT19937 *__pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ MT19937 *__pyx_t_2;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_rng", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":14
+ *
+ * cdef MT19937* _rng(self):
+ * if self.rng == NULL: # <<<<<<<<<<<<<<
+ * self.rng = new MT19937()
+ * return self.rng
+ */
+ __pyx_t_1 = (__pyx_v_self->rng == NULL);
+ if (__pyx_t_1) {
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":15
+ * cdef MT19937* _rng(self):
+ * if self.rng == NULL:
+ * self.rng = new MT19937() # <<<<<<<<<<<<<<
+ * return self.rng
+ *
+ */
+ try {__pyx_t_2 = new MT19937();} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+ __pyx_v_self->rng = __pyx_t_2;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":16
+ * if self.rng == NULL:
+ * self.rng = new MT19937()
+ * return self.rng # <<<<<<<<<<<<<<
+ *
+ * def viterbi(self):
+ */
+ __pyx_r = __pyx_v_self->rng;
+ goto __pyx_L0;
+
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_WriteUnraisable("_cdec.Hypergraph._rng", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
@@ -8519,8 +8744,8 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_self, C
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":13
- * del self.rng
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":18
+ * return self.rng
*
* def viterbi(self): # <<<<<<<<<<<<<<
* cdef vector[WordID] trans
@@ -8538,7 +8763,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":15
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":20
* def viterbi(self):
* cdef vector[WordID] trans
* hypergraph.ViterbiESentence(self.hg[0], &trans) # <<<<<<<<<<<<<<
@@ -8547,7 +8772,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H
*/
ViterbiESentence((__pyx_v_self->hg[0]), (&__pyx_v_trans));
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":16
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":21
* cdef vector[WordID] trans
* hypergraph.ViterbiESentence(self.hg[0], &trans)
* return unicode(GetString(trans).c_str(), 'utf8') # <<<<<<<<<<<<<<
@@ -8555,9 +8780,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H
* def viterbi_trees(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(TD::GetString(__pyx_v_trans).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(TD::GetString(__pyx_v_trans).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __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[3]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __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));
@@ -8565,7 +8790,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H
PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
@@ -8596,7 +8821,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":18
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":23
* return unicode(GetString(trans).c_str(), 'utf8')
*
* def viterbi_trees(self): # <<<<<<<<<<<<<<
@@ -8616,16 +8841,16 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_trees", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":19
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":24
*
* def viterbi_trees(self):
* f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<<
* e_tree = unicode(hypergraph.ViterbiETree(self.hg[0]).c_str(), 'utf8')
* return (f_tree, e_tree)
*/
- __pyx_t_1 = PyBytes_FromString(ViterbiFTree((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(ViterbiFTree((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __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[3]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __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));
@@ -8633,22 +8858,22 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_
PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_v_f_tree = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":20
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":25
* def viterbi_trees(self):
* f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8')
* e_tree = unicode(hypergraph.ViterbiETree(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<<
* return (f_tree, e_tree)
*
*/
- __pyx_t_1 = PyBytes_FromString(ViterbiETree((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(ViterbiETree((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __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[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __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));
@@ -8656,13 +8881,13 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_
PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_v_e_tree = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":21
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":26
* f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8')
* e_tree = unicode(hypergraph.ViterbiETree(self.hg[0]).c_str(), 'utf8')
* return (f_tree, e_tree) # <<<<<<<<<<<<<<
@@ -8670,7 +8895,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_
* def viterbi_features(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_v_f_tree));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f_tree));
@@ -8708,7 +8933,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_7viterbi_features(PyObject *__pyx_
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":23
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":28
* return (f_tree, e_tree)
*
* def viterbi_features(self): # <<<<<<<<<<<<<<
@@ -8726,20 +8951,20 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_features", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":24
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":29
*
* def viterbi_features(self):
* cdef SparseVector fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
* return fmap
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":25
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":30
* def viterbi_features(self):
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) # <<<<<<<<<<<<<<
@@ -8748,7 +8973,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj
*/
__pyx_v_fmap->vector = new FastSparseVector<weight_t>(ViterbiFeatures((__pyx_v_self->hg[0])));
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":26
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":31
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
* return fmap # <<<<<<<<<<<<<<
@@ -8784,7 +9009,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_9viterbi_joshua(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":28
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":33
* return fmap
*
* def viterbi_joshua(self): # <<<<<<<<<<<<<<
@@ -8802,7 +9027,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_joshua(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_joshua", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":29
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":34
*
* def viterbi_joshua(self):
* return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<<
@@ -8810,9 +9035,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_joshua(struct __pyx_obj_5
* def kbest(self, size):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(JoshuaVisualizationString((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(JoshuaVisualizationString((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __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[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __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));
@@ -8820,7 +9045,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_joshua(struct __pyx_obj_5
PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
@@ -8852,7 +9077,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_11kbest(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":31
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":36
* return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
*
* def kbest(self, size): # <<<<<<<<<<<<<<
@@ -8881,7 +9106,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_10kbest(struct __pyx_obj_5_cdec_Hy
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_12generator4, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_12generator4, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -8918,19 +9143,19 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator4(__pyx_GeneratorObject
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":32
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":37
*
* def kbest(self, size):
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal].Derivation* derivation
* cdef unsigned k
*/
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":35
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":40
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal].Derivation* derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -8939,18 +9164,18 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator4(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":36
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":41
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L5;}
for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_1;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":37
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":42
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -8959,7 +9184,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator4(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_derivation = __pyx_cur_scope->__pyx_v_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":38
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":43
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
@@ -8973,16 +9198,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator4(__pyx_GeneratorObject
}
__pyx_L9:;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":39
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":44
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
* yield unicode(GetString(derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<<
* finally:
* del derivations
*/
- __pyx_t_4 = PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_derivation->yield).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_derivation->yield).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
__Pyx_GIVEREF(((PyObject *)__pyx_t_4));
@@ -8990,7 +9215,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator4(__pyx_GeneratorObject
PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
@@ -9005,12 +9230,12 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator4(__pyx_GeneratorObject
__pyx_L10_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L5;}
}
__pyx_L8_break:;
}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":46
* yield unicode(GetString(derivation._yield).c_str(), 'utf8')
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -9053,6 +9278,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator4(__pyx_GeneratorObject
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -9069,7 +9295,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_14kbest_trees(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":43
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":48
* del derivations
*
* def kbest_trees(self, size): # <<<<<<<<<<<<<<
@@ -9098,7 +9324,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_13kbest_trees(struct __pyx_obj_5_c
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_15generator5, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_15generator5, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -9137,29 +9363,29 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":44
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":49
*
* def kbest_trees(self, size):
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal].Derivation* f_derivation
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal]* e_derivations = new kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal](self.hg[0], size)
*/
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_cur_scope->__pyx_v_f_derivations = new KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":46
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":51
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal](self.hg[0], size)
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal].Derivation* f_derivation
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal]* e_derivations = new kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal].Derivation* e_derivation
* cdef unsigned k
*/
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_cur_scope->__pyx_v_e_derivations = new KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":49
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":54
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal].Derivation* e_derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -9168,18 +9394,18 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":50
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":55
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L5;}
for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_1;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":51
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":56
* try:
* for k in range(size):
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -9188,7 +9414,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_f_derivation = __pyx_cur_scope->__pyx_v_f_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":52
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":57
* for k in range(size):
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -9197,7 +9423,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_e_derivation = __pyx_cur_scope->__pyx_v_e_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":53
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":58
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not f_derivation or not e_derivation: break # <<<<<<<<<<<<<<
@@ -9217,16 +9443,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
}
__pyx_L9:;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":54
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":59
* e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not f_derivation or not e_derivation: break
* f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<<
* e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8')
* yield (f_tree, e_tree)
*/
- __pyx_t_6 = PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_f_derivation->yield).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_6 = PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_f_derivation->yield).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_7);
PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
__Pyx_GIVEREF(((PyObject *)__pyx_t_6));
@@ -9234,7 +9460,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
@@ -9243,16 +9469,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
__pyx_cur_scope->__pyx_v_f_tree = ((PyObject*)__pyx_t_6);
__pyx_t_6 = 0;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":55
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":60
* if not f_derivation or not e_derivation: break
* f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8')
* e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<<
* yield (f_tree, e_tree)
* finally:
*/
- __pyx_t_6 = PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_e_derivation->yield).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_6 = PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_e_derivation->yield).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_7);
PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
__Pyx_GIVEREF(((PyObject *)__pyx_t_6));
@@ -9260,7 +9486,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
@@ -9269,14 +9495,14 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
__pyx_cur_scope->__pyx_v_e_tree = ((PyObject*)__pyx_t_6);
__pyx_t_6 = 0;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":56
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":61
* f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8')
* e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8')
* yield (f_tree, e_tree) # <<<<<<<<<<<<<<
* finally:
* del f_derivations
*/
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
@@ -9296,12 +9522,12 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
__pyx_L10_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L5;}
}
__pyx_L8_break:;
}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":58
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":63
* yield (f_tree, e_tree)
* finally:
* del f_derivations # <<<<<<<<<<<<<<
@@ -9325,7 +9551,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
__pyx_L6:;
delete __pyx_cur_scope->__pyx_v_f_derivations;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":64
* finally:
* del f_derivations
* del e_derivations # <<<<<<<<<<<<<<
@@ -9353,6 +9579,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -9369,7 +9596,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_17kbest_features(PyObject *__pyx_v
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":61
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":66
* del e_derivations
*
* def kbest_features(self, size): # <<<<<<<<<<<<<<
@@ -9398,7 +9625,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_16kbest_features(struct __pyx_obj_
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_18generator6, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_18generator6, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -9434,19 +9661,19 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":62
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":67
*
* def kbest_features(self, size):
* cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal].Derivation* derivation
* cdef SparseVector fmap
*/
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":66
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":71
* cdef SparseVector fmap
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -9455,18 +9682,18 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":67
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":72
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L5;}
for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_1;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":68
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":73
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -9475,7 +9702,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_derivation = __pyx_cur_scope->__pyx_v_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":69
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":74
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
@@ -9489,23 +9716,23 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject
}
__pyx_L9:;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":70
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":75
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
* fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* fmap.vector = new FastSparseVector[weight_t](derivation._yield)
* yield fmap
*/
- __pyx_t_4 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_4);
- if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
__Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
__Pyx_GIVEREF(__pyx_t_4);
__pyx_cur_scope->__pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":71
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":76
* if not derivation: break
* fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](derivation._yield) # <<<<<<<<<<<<<<
@@ -9514,7 +9741,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_cur_scope->__pyx_v_derivation->yield);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":72
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":77
* fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](derivation._yield)
* yield fmap # <<<<<<<<<<<<<<
@@ -9533,12 +9760,12 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject
__pyx_L10_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
}
__pyx_L8_break:;
}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":74
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":79
* yield fmap
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -9579,6 +9806,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -9592,7 +9820,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_20sample(PyObject *__pyx_v_self, P
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sample (wrapper)", 0);
assert(__pyx_arg_n); {
- __pyx_v_n = __Pyx_PyInt_AsUnsignedInt(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_n = __Pyx_PyInt_AsUnsignedInt(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -9605,12 +9833,12 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_20sample(PyObject *__pyx_v_self, P
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":76
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":81
* del derivations
*
* def sample(self, unsigned n): # <<<<<<<<<<<<<<
* cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
- * if self.rng == NULL:
+ * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos)
*/
static PyObject *__pyx_pf_5_cdec_10Hypergraph_19sample(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n) {
@@ -9632,7 +9860,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_19sample(struct __pyx_obj_5_cdec_H
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__pyx_cur_scope->__pyx_v_n = __pyx_v_n;
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_21generator7, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_21generator7, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -9654,65 +9882,42 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator7(__pyx_GeneratorObject
{
struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
- int __pyx_t_1;
- size_t __pyx_t_2;
- unsigned int __pyx_t_3;
+ size_t __pyx_t_1;
+ unsigned int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
case 0: goto __pyx_L3_first_run;
- case 1: goto __pyx_L10_resume_from_yield;
+ case 1: goto __pyx_L9_resume_from_yield;
default: /* CPython raises the right error here */
__Pyx_RefNannyFinishContext();
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":77
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":82
*
* def sample(self, unsigned n):
* cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() # <<<<<<<<<<<<<<
- * if self.rng == NULL:
- * self.rng = new MT19937()
+ * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos)
+ * cdef unsigned k
*/
__pyx_cur_scope->__pyx_v_hypos = new std::vector<HypergraphSampler::Hypothesis>();
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":78
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":83
* def sample(self, unsigned n):
* cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
- * if self.rng == NULL: # <<<<<<<<<<<<<<
- * self.rng = new MT19937()
- * hypergraph.sample_hypotheses(self.hg[0], n, self.rng, hypos)
- */
- __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->rng == NULL);
- if (__pyx_t_1) {
-
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":79
- * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
- * if self.rng == NULL:
- * self.rng = new MT19937() # <<<<<<<<<<<<<<
- * hypergraph.sample_hypotheses(self.hg[0], n, self.rng, hypos)
- * cdef unsigned k
- */
- __pyx_cur_scope->__pyx_v_self->rng = new MT19937();
- goto __pyx_L4;
- }
- __pyx_L4:;
-
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":80
- * if self.rng == NULL:
- * self.rng = new MT19937()
- * hypergraph.sample_hypotheses(self.hg[0], n, self.rng, hypos) # <<<<<<<<<<<<<<
+ * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos) # <<<<<<<<<<<<<<
* cdef unsigned k
* try:
*/
- HypergraphSampler::sample_hypotheses((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, __pyx_cur_scope->__pyx_v_self->rng, __pyx_cur_scope->__pyx_v_hypos);
+ HypergraphSampler::sample_hypotheses((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, ((struct __pyx_vtabstruct_5_cdec_Hypergraph *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_rng(__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_hypos);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":82
- * hypergraph.sample_hypotheses(self.hg[0], n, self.rng, hypos)
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":85
+ * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos)
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
* for k in range(hypos.size()):
@@ -9720,54 +9925,54 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator7(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":83
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":86
* cdef unsigned k
* try:
* for k in range(hypos.size()): # <<<<<<<<<<<<<<
* yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8')
* finally:
*/
- __pyx_t_2 = __pyx_cur_scope->__pyx_v_hypos->size();
- for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
- __pyx_cur_scope->__pyx_v_k = __pyx_t_3;
+ __pyx_t_1 = __pyx_cur_scope->__pyx_v_hypos->size();
+ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
+ __pyx_cur_scope->__pyx_v_k = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":84
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":87
* try:
* for k in range(hypos.size()):
* yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8') # <<<<<<<<<<<<<<
* finally:
* del hypos
*/
- __pyx_t_4 = PyBytes_FromString(TD::GetString(((__pyx_cur_scope->__pyx_v_hypos[0])[__pyx_cur_scope->__pyx_v_k]).words).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+ __pyx_t_3 = PyBytes_FromString(TD::GetString(((__pyx_cur_scope->__pyx_v_hypos[0])[__pyx_cur_scope->__pyx_v_k]).words).c_str()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 0;
- __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
- __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
+ __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 1;
return __pyx_r;
- __pyx_L10_resume_from_yield:;
- __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
- __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;}
+ __pyx_L9_resume_from_yield:;
+ __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L5;}
}
}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":86
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":89
* yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8')
* finally:
* del hypos # <<<<<<<<<<<<<<
@@ -9779,16 +9984,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator7(__pyx_GeneratorObject
PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
int __pyx_exc_lineno;
__pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L7;
- __pyx_L6: {
+ __pyx_why = 0; goto __pyx_L6;
+ __pyx_L5: {
__pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
__pyx_exc_lineno = __pyx_lineno;
- goto __pyx_L7;
+ goto __pyx_L6;
}
- __pyx_L7:;
+ __pyx_L6:;
delete __pyx_cur_scope->__pyx_v_hypos;
switch (__pyx_why) {
case 4: {
@@ -9804,12 +10009,13 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator7(__pyx_GeneratorObject
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -9823,7 +10029,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_23sample_trees(PyObject *__pyx_v_s
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sample_trees (wrapper)", 0);
assert(__pyx_arg_n); {
- __pyx_v_n = __Pyx_PyInt_AsUnsignedInt(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_n = __Pyx_PyInt_AsUnsignedInt(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -9836,12 +10042,12 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_23sample_trees(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":88
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":91
* del hypos
*
* def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
* cdef vector[string]* trees = new vector[string]()
- * if self.rng == NULL:
+ * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees)
*/
static PyObject *__pyx_pf_5_cdec_10Hypergraph_22sample_trees(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n) {
@@ -9863,7 +10069,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_22sample_trees(struct __pyx_obj_5_
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__pyx_cur_scope->__pyx_v_n = __pyx_v_n;
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_24generator8, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_24generator8, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -9885,65 +10091,42 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_24generator8(__pyx_GeneratorObject
{
struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
- int __pyx_t_1;
- size_t __pyx_t_2;
- unsigned int __pyx_t_3;
+ size_t __pyx_t_1;
+ unsigned int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
case 0: goto __pyx_L3_first_run;
- case 1: goto __pyx_L10_resume_from_yield;
+ case 1: goto __pyx_L9_resume_from_yield;
default: /* CPython raises the right error here */
__Pyx_RefNannyFinishContext();
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":89
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":92
*
* def sample_trees(self, unsigned n):
* cdef vector[string]* trees = new vector[string]() # <<<<<<<<<<<<<<
- * if self.rng == NULL:
- * self.rng = new MT19937()
+ * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees)
+ * cdef unsigned k
*/
__pyx_cur_scope->__pyx_v_trees = new std::vector<std::string>();
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":90
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":93
* def sample_trees(self, unsigned n):
* cdef vector[string]* trees = new vector[string]()
- * if self.rng == NULL: # <<<<<<<<<<<<<<
- * self.rng = new MT19937()
- * hypergraph.sample_trees(self.hg[0], n, self.rng, trees)
- */
- __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->rng == NULL);
- if (__pyx_t_1) {
-
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":91
- * cdef vector[string]* trees = new vector[string]()
- * if self.rng == NULL:
- * self.rng = new MT19937() # <<<<<<<<<<<<<<
- * hypergraph.sample_trees(self.hg[0], n, self.rng, trees)
- * cdef unsigned k
- */
- __pyx_cur_scope->__pyx_v_self->rng = new MT19937();
- goto __pyx_L4;
- }
- __pyx_L4:;
-
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":92
- * if self.rng == NULL:
- * self.rng = new MT19937()
- * hypergraph.sample_trees(self.hg[0], n, self.rng, trees) # <<<<<<<<<<<<<<
+ * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees) # <<<<<<<<<<<<<<
* cdef unsigned k
* try:
*/
- HypergraphSampler::sample_trees((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, __pyx_cur_scope->__pyx_v_self->rng, __pyx_cur_scope->__pyx_v_trees);
+ HypergraphSampler::sample_trees((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, ((struct __pyx_vtabstruct_5_cdec_Hypergraph *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_rng(__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_trees);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":94
- * hypergraph.sample_trees(self.hg[0], n, self.rng, trees)
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":95
+ * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees)
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
* for k in range(trees.size()):
@@ -9951,54 +10134,54 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_24generator8(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":95
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":96
* cdef unsigned k
* try:
* for k in range(trees.size()): # <<<<<<<<<<<<<<
* yield unicode(trees[0][k].c_str(), 'utf8')
* finally:
*/
- __pyx_t_2 = __pyx_cur_scope->__pyx_v_trees->size();
- for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
- __pyx_cur_scope->__pyx_v_k = __pyx_t_3;
+ __pyx_t_1 = __pyx_cur_scope->__pyx_v_trees->size();
+ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
+ __pyx_cur_scope->__pyx_v_k = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":96
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":97
* try:
* for k in range(trees.size()):
* yield unicode(trees[0][k].c_str(), 'utf8') # <<<<<<<<<<<<<<
* finally:
* del trees
*/
- __pyx_t_4 = PyBytes_FromString(((__pyx_cur_scope->__pyx_v_trees[0])[__pyx_cur_scope->__pyx_v_k]).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L6;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L6;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+ __pyx_t_3 = PyBytes_FromString(((__pyx_cur_scope->__pyx_v_trees[0])[__pyx_cur_scope->__pyx_v_k]).c_str()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L6;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 0;
- __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
- __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
+ __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 1;
return __pyx_r;
- __pyx_L10_resume_from_yield:;
- __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
- __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L6;}
+ __pyx_L9_resume_from_yield:;
+ __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L5;}
}
}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":98
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":99
* yield unicode(trees[0][k].c_str(), 'utf8')
* finally:
* del trees # <<<<<<<<<<<<<<
@@ -10010,16 +10193,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_24generator8(__pyx_GeneratorObject
PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
int __pyx_exc_lineno;
__pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L7;
- __pyx_L6: {
+ __pyx_why = 0; goto __pyx_L6;
+ __pyx_L5: {
__pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
__pyx_exc_lineno = __pyx_lineno;
- goto __pyx_L7;
+ goto __pyx_L6;
}
- __pyx_L7:;
+ __pyx_L6:;
delete __pyx_cur_scope->__pyx_v_trees;
switch (__pyx_why) {
case 4: {
@@ -10035,12 +10218,13 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_24generator8(__pyx_GeneratorObject
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("sample_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -10051,7 +10235,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_26intersect(PyObject *__pyx_v_self
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("intersect (wrapper)", 0);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lat), __pyx_ptype_5_cdec_Lattice, 1, "lat", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lat), __pyx_ptype_5_cdec_Lattice, 1, "lat", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_5_cdec_10Hypergraph_25intersect(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_lat));
goto __pyx_L0;
__pyx_L1_error:;
@@ -10061,7 +10245,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_26intersect(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":100
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":101
* del trees
*
* def intersect(self, Lattice lat): # <<<<<<<<<<<<<<
@@ -10078,7 +10262,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_25intersect(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("intersect", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":101
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":102
*
* def intersect(self, Lattice lat):
* return hypergraph.Intersect(lat.lattice[0], self.hg) # <<<<<<<<<<<<<<
@@ -10086,7 +10270,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_25intersect(struct __pyx_obj_5_cde
* def prune(self, beam_alpha=0, density=0, **kwargs):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong(HG::Intersect((__pyx_v_lat->lattice[0]), __pyx_v_self->hg)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBool_FromLong(HG::Intersect((__pyx_v_lat->lattice[0]), __pyx_v_self->hg)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -10110,13 +10294,13 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_28prune(PyObject *__pyx_v_self, Py
PyObject *__pyx_v_beam_alpha = 0;
PyObject *__pyx_v_density = 0;
PyObject *__pyx_v_kwargs = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__beam_alpha,&__pyx_n_s__density,0};
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("prune (wrapper)", 0);
__pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
__Pyx_GOTREF(__pyx_v_kwargs);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__beam_alpha,&__pyx_n_s__density,0};
PyObject* values[2] = {0,0};
values[0] = ((PyObject *)__pyx_int_0);
values[1] = ((PyObject *)__pyx_int_0);
@@ -10143,7 +10327,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_28prune(PyObject *__pyx_v_self, Py
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "prune") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "prune") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -10158,7 +10342,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_28prune(PyObject *__pyx_v_self, Py
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("prune", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("prune", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
__Pyx_AddTraceback("_cdec.Hypergraph.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -10171,7 +10355,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_28prune(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":103
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":104
* return hypergraph.Intersect(lat.lattice[0], self.hg)
*
* def prune(self, beam_alpha=0, density=0, **kwargs): # <<<<<<<<<<<<<<
@@ -10191,7 +10375,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27prune(struct __pyx_obj_5_cdec_Hy
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("prune", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":104
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":105
*
* def prune(self, beam_alpha=0, density=0, **kwargs):
* cdef hypergraph.EdgeMask* preserve_mask = NULL # <<<<<<<<<<<<<<
@@ -10200,17 +10384,17 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27prune(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_preserve_mask = NULL;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":105
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":106
* def prune(self, beam_alpha=0, density=0, **kwargs):
* cdef hypergraph.EdgeMask* preserve_mask = NULL
* if 'csplit_preserve_full_word' in kwargs: # <<<<<<<<<<<<<<
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size())
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
*/
- __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s_15)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s_15)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":106
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":107
* cdef hypergraph.EdgeMask* preserve_mask = NULL
* if 'csplit_preserve_full_word' in kwargs:
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size()) # <<<<<<<<<<<<<<
@@ -10219,7 +10403,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27prune(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_preserve_mask = new std::vector<bool>(__pyx_v_self->hg->edges_.size());
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":107
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":108
* if 'csplit_preserve_full_word' in kwargs:
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size())
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True # <<<<<<<<<<<<<<
@@ -10231,18 +10415,18 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27prune(struct __pyx_obj_5_cdec_Hy
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":108
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":109
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size())
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False) # <<<<<<<<<<<<<<
* if preserve_mask:
* del preserve_mask
*/
- __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_beam_alpha); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_density); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_beam_alpha); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_density); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->hg->PruneInsideOutside(__pyx_t_2, __pyx_t_3, __pyx_v_preserve_mask, 0, 1.0, 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":109
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":110
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False)
* if preserve_mask: # <<<<<<<<<<<<<<
@@ -10252,7 +10436,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27prune(struct __pyx_obj_5_cdec_Hy
__pyx_t_1 = (__pyx_v_preserve_mask != 0);
if (__pyx_t_1) {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":110
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":111
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False)
* if preserve_mask:
* del preserve_mask # <<<<<<<<<<<<<<
@@ -10286,7 +10470,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_30lattice(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":112
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":113
* del preserve_mask
*
* def lattice(self): # TODO direct hg -> lattice conversion in cdec # <<<<<<<<<<<<<<
@@ -10306,20 +10490,20 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29lattice(struct __pyx_obj_5_cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lattice", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":113
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":114
*
* def lattice(self): # TODO direct hg -> lattice conversion in cdec
* cdef str plf = hypergraph.AsPLF(self.hg[0], True).c_str() # <<<<<<<<<<<<<<
* return Lattice(eval(plf))
*
*/
- __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->hg[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->hg[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- if (!(likely(PyString_CheckExact(((PyObject *)__pyx_t_1)))||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(((PyObject *)__pyx_t_1))->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(PyString_CheckExact(((PyObject *)__pyx_t_1)))||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(((PyObject *)__pyx_t_1))->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_plf = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":114
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":115
* def lattice(self): # TODO direct hg -> lattice conversion in cdec
* cdef str plf = hypergraph.AsPLF(self.hg[0], True).c_str()
* return Lattice(eval(plf)) # <<<<<<<<<<<<<<
@@ -10327,17 +10511,17 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29lattice(struct __pyx_obj_5_cdec_
* def reweight(self, weights):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
if (((PyObject *)__pyx_v_plf)) {
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__plf), ((PyObject *)__pyx_v_plf)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__plf), ((PyObject *)__pyx_v_plf)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
if (((PyObject *)__pyx_v_self)) {
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_v_self)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_v_self)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)__pyx_v_plf));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_plf));
@@ -10348,15 +10532,15 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29lattice(struct __pyx_obj_5_cdec_
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_1 = 0;
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_eval, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_eval, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Lattice)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Lattice)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
@@ -10389,7 +10573,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_32reweight(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":116
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":117
* return Lattice(eval(plf))
*
* def reweight(self, weights): # <<<<<<<<<<<<<<
@@ -10408,7 +10592,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("reweight", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":117
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":118
*
* def reweight(self, weights):
* if isinstance(weights, SparseVector): # <<<<<<<<<<<<<<
@@ -10421,7 +10605,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":118
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":119
* def reweight(self, weights):
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0]) # <<<<<<<<<<<<<<
@@ -10432,7 +10616,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec
goto __pyx_L3;
}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":119
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":120
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0])
* elif isinstance(weights, DenseVector): # <<<<<<<<<<<<<<
@@ -10445,7 +10629,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":120
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":121
* self.hg.Reweight((<SparseVector> weights).vector[0])
* elif isinstance(weights, DenseVector):
* self.hg.Reweight((<DenseVector> weights).vector[0]) # <<<<<<<<<<<<<<
@@ -10457,26 +10641,26 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec
}
/*else*/ {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":122
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":123
* self.hg.Reweight((<DenseVector> weights).vector[0])
* else:
* raise TypeError('cannot reweight hypergraph with %s' % type(weights)) # <<<<<<<<<<<<<<
*
* property edges:
*/
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -10505,7 +10689,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":125
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":126
*
* property edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -10531,7 +10715,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_5_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_5edges_2generator9, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_5edges_2generator9, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -10567,9 +10751,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":127
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":128
* def __get__(self):
* cdef unsigned i
* for i in range(self.hg.edges_.size()): # <<<<<<<<<<<<<<
@@ -10580,16 +10764,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":128
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":129
* cdef unsigned i
* for i in range(self.hg.edges_.size()):
* yield HypergraphEdge().init(self.hg, i) # <<<<<<<<<<<<<<
*
* property nodes:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
@@ -10604,7 +10788,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -10615,6 +10799,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -10631,7 +10816,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":131
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":132
*
* property nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -10657,7 +10842,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_5_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -10693,9 +10878,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":133
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":134
* def __get__(self):
* cdef unsigned i
* for i in range(self.hg.nodes_.size()): # <<<<<<<<<<<<<<
@@ -10706,16 +10891,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":134
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":135
* cdef unsigned i
* for i in range(self.hg.nodes_.size()):
* yield HypergraphNode().init(self.hg, i) # <<<<<<<<<<<<<<
*
* property goal:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
@@ -10730,7 +10915,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -10741,6 +10926,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -10756,7 +10942,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":137
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":138
*
* property goal:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -10774,7 +10960,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":138
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":139
* property goal:
* def __get__(self):
* return HypergraphNode().init(self.hg, self.hg.GoalNode()) # <<<<<<<<<<<<<<
@@ -10782,9 +10968,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_c
* property npaths:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->hg->GoalNode()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->hg->GoalNode()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
@@ -10815,7 +11001,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *__pyx_v
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":141
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":142
*
* property npaths:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -10832,7 +11018,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":142
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":143
* property npaths:
* def __get__(self):
* return self.hg.NumberOfPaths() # <<<<<<<<<<<<<<
@@ -10840,7 +11026,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5
* def inside_outside(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->hg->NumberOfPaths()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->hg->NumberOfPaths()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -10869,7 +11055,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_34inside_outside(PyObject *__pyx_v
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":144
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":145
* return self.hg.NumberOfPaths()
*
* def inside_outside(self): # <<<<<<<<<<<<<<
@@ -10893,7 +11079,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("inside_outside", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":145
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":146
*
* def inside_outside(self):
* cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() # <<<<<<<<<<<<<<
@@ -10902,7 +11088,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
__pyx_v_result = new FastSparseVector<prob_t>();
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":146
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":147
* def inside_outside(self):
* cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) # <<<<<<<<<<<<<<
@@ -10911,7 +11097,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
__pyx_v_z = InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>((__pyx_v_self->hg[0]), __pyx_v_result);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":147
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":148
* cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result)
* result[0] /= z # <<<<<<<<<<<<<<
@@ -10920,20 +11106,20 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
(__pyx_v_result[0]) /= __pyx_v_z;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":148
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":149
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result)
* result[0] /= z
* cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* vector.vector = new FastSparseVector[double]()
* cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False)
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":149
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":150
* result[0] /= z
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double]() # <<<<<<<<<<<<<<
@@ -10942,7 +11128,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
__pyx_v_vector->vector = new FastSparseVector<double>();
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":150
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":151
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double]()
* cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False) # <<<<<<<<<<<<<<
@@ -10951,7 +11137,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
__pyx_v_it = new FastSparseVector<prob_t>::const_iterator((__pyx_v_result[0]), 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":152
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":153
* cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False)
* cdef unsigned i
* for i in range(result.size()): # <<<<<<<<<<<<<<
@@ -10962,7 +11148,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":153
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":154
* cdef unsigned i
* for i in range(result.size()):
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) # <<<<<<<<<<<<<<
@@ -10971,7 +11157,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
__pyx_v_vector->vector->set_value((__pyx_v_it[0]).operator->()->first, log((__pyx_v_it[0]).operator->()->second));
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":154
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":155
* for i in range(result.size()):
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second))
* pinc(it[0]) # ++it # <<<<<<<<<<<<<<
@@ -10981,7 +11167,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
(++(__pyx_v_it[0]));
}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":155
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":156
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second))
* pinc(it[0]) # ++it
* del it # <<<<<<<<<<<<<<
@@ -10990,7 +11176,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
delete __pyx_v_it;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":156
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":157
* pinc(it[0]) # ++it
* del it
* del result # <<<<<<<<<<<<<<
@@ -10999,7 +11185,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
*/
delete __pyx_v_result;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":157
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":158
* del it
* del result
* return vector # <<<<<<<<<<<<<<
@@ -11024,7 +11210,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":164
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":165
* cdef public TRule trule
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
@@ -11041,7 +11227,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("init", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":165
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":166
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg # <<<<<<<<<<<<<<
@@ -11050,7 +11236,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->hg = __pyx_v_hg;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":166
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":167
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg
* self.edge = &hg.edges_[i] # <<<<<<<<<<<<<<
@@ -11059,23 +11245,23 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->edge = (&(__pyx_v_hg->edges_[__pyx_v_i]));
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":167
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":168
* self.hg = hg
* self.edge = &hg.edges_[i]
* self.trule = TRule.__new__(TRule) # <<<<<<<<<<<<<<
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_)
* return self
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_TRule)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_TRule)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_TRule)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_TRule)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->trule);
__Pyx_DECREF(((PyObject *)__pyx_v_self->trule));
__pyx_v_self->trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":168
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":169
* self.edge = &hg.edges_[i]
* self.trule = TRule.__new__(TRule)
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) # <<<<<<<<<<<<<<
@@ -11084,7 +11270,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->trule->rule = new boost::shared_ptr<TRule>(__pyx_v_self->edge->rule_);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":169
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":170
* self.trule = TRule.__new__(TRule)
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_)
* return self # <<<<<<<<<<<<<<
@@ -11119,7 +11305,7 @@ static Py_ssize_t __pyx_pw_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":171
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":172
* return self
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -11132,7 +11318,7 @@ static Py_ssize_t __pyx_pf_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":172
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":173
*
* def __len__(self):
* return self.edge.tail_nodes_.size() # <<<<<<<<<<<<<<
@@ -11159,7 +11345,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject *
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":175
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":176
*
* property head_node:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11177,7 +11363,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":176
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":177
* property head_node:
* def __get__(self):
* return HypergraphNode().init(self.hg, self.edge.head_node_) # <<<<<<<<<<<<<<
@@ -11185,9 +11371,9 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __py
* property tail_nodes:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->edge->head_node_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->edge->head_node_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
@@ -11219,7 +11405,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":179
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":180
*
* property tail_nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11245,7 +11431,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -11281,9 +11467,9 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":181
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":182
* def __get__(self):
* cdef unsigned i
* for i in range(self.edge.tail_nodes_.size()): # <<<<<<<<<<<<<<
@@ -11294,16 +11480,16 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":182
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":183
* cdef unsigned i
* for i in range(self.edge.tail_nodes_.size()):
* yield HypergraphNode().init(self.hg, self.edge.tail_nodes_[i]) # <<<<<<<<<<<<<<
*
* property span:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->edge->tail_nodes_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->edge->tail_nodes_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
@@ -11318,7 +11504,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -11329,6 +11515,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -11344,7 +11531,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":185
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":186
*
* property span:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11363,7 +11550,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":186
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":187
* property span:
* def __get__(self):
* return (self.edge.i_, self.edge.j_) # <<<<<<<<<<<<<<
@@ -11371,11 +11558,11 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj
* property feature_values:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyInt_FromLong(__pyx_v_self->edge->i_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromLong(__pyx_v_self->edge->i_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyInt_FromLong(__pyx_v_self->edge->j_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyInt_FromLong(__pyx_v_self->edge->j_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -11412,7 +11599,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyOb
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":189
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":190
*
* property feature_values:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11430,20 +11617,20 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":190
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":191
* property feature_values:
* def __get__(self):
* cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* vector.vector = new FastSparseVector[double](self.edge.feature_values_)
* return vector
*/
- __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_SparseVector)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":191
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":192
* def __get__(self):
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double](self.edge.feature_values_) # <<<<<<<<<<<<<<
@@ -11452,7 +11639,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc
*/
__pyx_v_vector->vector = new FastSparseVector<double>(__pyx_v_self->edge->feature_values_);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":192
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":193
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double](self.edge.feature_values_)
* return vector # <<<<<<<<<<<<<<
@@ -11488,7 +11675,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":195
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":196
*
* property prob:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11505,7 +11692,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":196
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":197
* property prob:
* def __get__(self):
* return self.edge.edge_prob_.as_float() # <<<<<<<<<<<<<<
@@ -11513,7 +11700,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->edge->edge_prob_.as_float()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->edge->edge_prob_.as_float()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -11537,8 +11724,8 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5_cdec_HypergraphEdge, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5_cdec_HypergraphEdge, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5_cdec_HypergraphEdge, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5_cdec_HypergraphEdge, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_x), ((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_y), ((int)__pyx_v_op));
goto __pyx_L0;
__pyx_L1_error:;
@@ -11548,7 +11735,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":198
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":199
* return self.edge.edge_prob_.as_float()
*
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<<
@@ -11566,7 +11753,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":201
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":202
* if op == 2: # ==
* return x.edge == y.edge
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -11575,7 +11762,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*/
switch (__pyx_v_op) {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":199
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":200
*
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -11584,7 +11771,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*/
case 2:
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":200
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":201
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
* if op == 2: # ==
* return x.edge == y.edge # <<<<<<<<<<<<<<
@@ -11592,14 +11779,14 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
* return not (x == y)
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_x->edge == __pyx_v_y->edge)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_x->edge == __pyx_v_y->edge)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
break;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":201
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":202
* if op == 2: # ==
* return x.edge == y.edge
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -11608,7 +11795,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*/
case 3:
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":202
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":203
* return x.edge == y.edge
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
@@ -11616,11 +11803,11 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -11628,18 +11815,18 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
break;
}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":203
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":204
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<<
*
* cdef class HypergraphNode:
*/
- __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
@@ -11664,7 +11851,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__py
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":162
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":163
* cdef hypergraph.Hypergraph* hg
* cdef hypergraph.HypergraphEdge* edge
* cdef public TRule trule # <<<<<<<<<<<<<<
@@ -11706,7 +11893,7 @@ static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_2__set__(struct __pyx_obj_5_c
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5_cdec_TRule))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5_cdec_TRule))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_INCREF(__pyx_v_value);
__Pyx_GIVEREF(__pyx_v_value);
__Pyx_GOTREF(__pyx_v_self->trule);
@@ -11749,7 +11936,7 @@ static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_5_c
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":209
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":210
* cdef hypergraph.HypergraphNode* node
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
@@ -11762,7 +11949,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("init", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":210
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":211
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg # <<<<<<<<<<<<<<
@@ -11771,7 +11958,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->hg = __pyx_v_hg;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":211
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":212
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg
* self.node = &hg.nodes_[i] # <<<<<<<<<<<<<<
@@ -11780,7 +11967,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->node = (&(__pyx_v_hg->nodes_[__pyx_v_i]));
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":212
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":213
* self.hg = hg
* self.node = &hg.nodes_[i]
* return self # <<<<<<<<<<<<<<
@@ -11811,7 +11998,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *_
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":215
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":216
*
* property in_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11837,7 +12024,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -11873,9 +12060,9 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":217
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":218
* def __get__(self):
* cdef unsigned i
* for i in range(self.node.in_edges_.size()): # <<<<<<<<<<<<<<
@@ -11886,16 +12073,16 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":218
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":219
* cdef unsigned i
* for i in range(self.node.in_edges_.size()):
* yield HypergraphEdge().init(self.hg, self.node.in_edges_[i]) # <<<<<<<<<<<<<<
*
* property out_edges:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->in_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->in_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
@@ -11910,7 +12097,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -11921,6 +12108,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -11937,7 +12125,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":221
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":222
*
* property out_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11963,7 +12151,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(struct __py
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -11999,9 +12187,9 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":223
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":224
* def __get__(self):
* cdef unsigned i
* for i in range(self.node.out_edges_.size()): # <<<<<<<<<<<<<<
@@ -12012,16 +12200,16 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":224
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":225
* cdef unsigned i
* for i in range(self.node.out_edges_.size()):
* yield HypergraphEdge().init(self.hg, self.node.out_edges_[i]) # <<<<<<<<<<<<<<
*
* property span:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->out_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->out_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
@@ -12036,7 +12224,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -12047,6 +12235,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -12062,7 +12251,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":227
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":228
*
* property span:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -12080,7 +12269,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":228
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":229
* property span:
* def __get__(self):
* return next(self.in_edges).span # <<<<<<<<<<<<<<
@@ -12088,12 +12277,12 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj
* property cat:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__in_edges); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__in_edges); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__span); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__span); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
@@ -12124,7 +12313,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":231
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":232
*
* property cat:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -12141,7 +12330,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":232
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":233
* property cat:
* def __get__(self):
* if self.node.cat_: # <<<<<<<<<<<<<<
@@ -12150,7 +12339,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_
*/
if (__pyx_v_self->node->cat_) {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":233
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":234
* def __get__(self):
* if self.node.cat_:
* return TDConvert(-self.node.cat_) # <<<<<<<<<<<<<<
@@ -12158,7 +12347,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_self->node->cat_))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_self->node->cat_))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
@@ -12185,8 +12374,8 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5_cdec_HypergraphNode, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5_cdec_HypergraphNode, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5_cdec_HypergraphNode, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5_cdec_HypergraphNode, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_5_cdec_14HypergraphNode___richcmp__(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_x), ((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_y), ((int)__pyx_v_op));
goto __pyx_L0;
__pyx_L1_error:;
@@ -12196,7 +12385,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/hypergraph.pxi":235
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":236
* return TDConvert(-self.node.cat_)
*
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<<
@@ -12214,7 +12403,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":238
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":239
* if op == 2: # ==
* return x.node == y.node
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -12223,7 +12412,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
*/
switch (__pyx_v_op) {
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":236
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":237
*
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -12232,7 +12421,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
*/
case 2:
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":237
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":238
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
* if op == 2: # ==
* return x.node == y.node # <<<<<<<<<<<<<<
@@ -12240,14 +12429,14 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
* return not (x == y)
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_x->node == __pyx_v_y->node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_x->node == __pyx_v_y->node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
break;
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":238
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":239
* if op == 2: # ==
* return x.node == y.node
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -12256,18 +12445,18 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
*/
case 3:
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":239
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":240
* return x.node == y.node
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
* raise NotImplemented('comparison not implemented for HypergraphNode')
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -12275,16 +12464,16 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
break;
}
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":240
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":241
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<<
*/
- __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
@@ -12302,11 +12491,11 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_inp = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__inp,0};
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__inp,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -12319,8 +12508,7 @@ static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__inp);
- if (likely(values[0])) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__inp)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
@@ -12346,7 +12534,7 @@ static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/lattice.pxi":6
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":6
* cdef lattice.Lattice* lattice
*
* def __cinit__(self, inp): # <<<<<<<<<<<<<<
@@ -12373,7 +12561,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
__Pyx_RefNannySetupContext("__cinit__", 0);
__Pyx_INCREF(__pyx_v_inp);
- /* "/home/cdyer/cdec/python/src/lattice.pxi":7
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":7
*
* def __cinit__(self, inp):
* if isinstance(inp, tuple): # <<<<<<<<<<<<<<
@@ -12386,7 +12574,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/home/cdyer/cdec/python/src/lattice.pxi":8
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":8
* def __cinit__(self, inp):
* if isinstance(inp, tuple):
* self.lattice = new lattice.Lattice(len(inp)) # <<<<<<<<<<<<<<
@@ -12396,7 +12584,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
__pyx_t_3 = PyObject_Length(__pyx_v_inp); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->lattice = new Lattice(__pyx_t_3);
- /* "/home/cdyer/cdec/python/src/lattice.pxi":9
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":9
* if isinstance(inp, tuple):
* self.lattice = new lattice.Lattice(len(inp))
* for i, arcs in enumerate(inp): # <<<<<<<<<<<<<<
@@ -12416,10 +12604,18 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
for (;;) {
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_4)) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_4)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_6 = __pyx_t_5(__pyx_t_4);
if (unlikely(!__pyx_t_6)) {
@@ -12443,7 +12639,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
__pyx_t_1 = __pyx_t_6;
__pyx_t_6 = 0;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":10
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":10
* self.lattice = new lattice.Lattice(len(inp))
* for i, arcs in enumerate(inp):
* self[i] = arcs # <<<<<<<<<<<<<<
@@ -12458,7 +12654,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
}
/*else*/ {
- /* "/home/cdyer/cdec/python/src/lattice.pxi":12
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":12
* self[i] = arcs
* else:
* if isinstance(inp, unicode): # <<<<<<<<<<<<<<
@@ -12471,7 +12667,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/home/cdyer/cdec/python/src/lattice.pxi":13
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":13
* else:
* if isinstance(inp, unicode):
* inp = inp.encode('utf8') # <<<<<<<<<<<<<<
@@ -12490,7 +12686,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
}
__pyx_L6:;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":14
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":14
* if isinstance(inp, unicode):
* inp = inp.encode('utf8')
* if not isinstance(inp, str): # <<<<<<<<<<<<<<
@@ -12504,7 +12700,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
__pyx_t_7 = (!__pyx_t_2);
if (__pyx_t_7) {
- /* "/home/cdyer/cdec/python/src/lattice.pxi":15
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":15
* inp = inp.encode('utf8')
* if not isinstance(inp, str):
* raise TypeError('Cannot create lattice from %s' % type(inp)) # <<<<<<<<<<<<<<
@@ -12528,7 +12724,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
}
__pyx_L7:;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":16
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":16
* if not isinstance(inp, str):
* raise TypeError('Cannot create lattice from %s' % type(inp))
* self.lattice = new lattice.Lattice() # <<<<<<<<<<<<<<
@@ -12537,7 +12733,7 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_
*/
__pyx_v_self->lattice = new Lattice();
- /* "/home/cdyer/cdec/python/src/lattice.pxi":17
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":17
* raise TypeError('Cannot create lattice from %s' % type(inp))
* self.lattice = new lattice.Lattice()
* lattice.ConvertTextToLattice(string(<char *>inp), self.lattice) # <<<<<<<<<<<<<<
@@ -12574,7 +12770,7 @@ static void __pyx_pw_5_cdec_7Lattice_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/home/cdyer/cdec/python/src/lattice.pxi":19
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":19
* lattice.ConvertTextToLattice(string(<char *>inp), self.lattice)
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -12586,7 +12782,7 @@ static void __pyx_pf_5_cdec_7Lattice_2__dealloc__(CYTHON_UNUSED struct __pyx_obj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/home/cdyer/cdec/python/src/lattice.pxi":20
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":20
*
* def __dealloc__(self):
* del self.lattice # <<<<<<<<<<<<<<
@@ -12619,7 +12815,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_5__getitem__(PyObject *__pyx_v_self, P
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/lattice.pxi":22
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":22
* del self.lattice
*
* def __getitem__(self, int index): # <<<<<<<<<<<<<<
@@ -12649,7 +12845,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/home/cdyer/cdec/python/src/lattice.pxi":23
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":23
*
* def __getitem__(self, int index):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -12664,7 +12860,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
__pyx_t_3 = (!__pyx_t_1);
if (__pyx_t_3) {
- /* "/home/cdyer/cdec/python/src/lattice.pxi":24
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":24
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
@@ -12680,7 +12876,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":25
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":25
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range')
* arcs = [] # <<<<<<<<<<<<<<
@@ -12692,7 +12888,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
__pyx_v_arcs = __pyx_t_4;
__pyx_t_4 = 0;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":26
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":26
* raise IndexError('lattice index out of range')
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index] # <<<<<<<<<<<<<<
@@ -12701,7 +12897,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
*/
__pyx_v_arc_vector = ((__pyx_v_self->lattice[0])[__pyx_v_index]);
- /* "/home/cdyer/cdec/python/src/lattice.pxi":29
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":29
* cdef lattice.LatticeArc* arc
* cdef unsigned i
* for i in range(arc_vector.size()): # <<<<<<<<<<<<<<
@@ -12712,7 +12908,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
__pyx_v_i = __pyx_t_6;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":30
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":30
* cdef unsigned i
* for i in range(arc_vector.size()):
* arc = &arc_vector[i] # <<<<<<<<<<<<<<
@@ -12721,7 +12917,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
*/
__pyx_v_arc = (&(__pyx_v_arc_vector[__pyx_v_i]));
- /* "/home/cdyer/cdec/python/src/lattice.pxi":31
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":31
* for i in range(arc_vector.size()):
* arc = &arc_vector[i]
* label = unicode(TDConvert(arc.label), 'utf8') # <<<<<<<<<<<<<<
@@ -12745,7 +12941,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
__pyx_v_label = ((PyObject*)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":32
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":32
* arc = &arc_vector[i]
* label = unicode(TDConvert(arc.label), 'utf8')
* arcs.append((label, arc.cost, arc.dist2next)) # <<<<<<<<<<<<<<
@@ -12771,7 +12967,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_4__getitem__(struct __pyx_obj_5_cdec_L
__Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
}
- /* "/home/cdyer/cdec/python/src/lattice.pxi":33
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":33
* label = unicode(TDConvert(arc.label), 'utf8')
* arcs.append((label, arc.cost, arc.dist2next))
* return tuple(arcs) # <<<<<<<<<<<<<<
@@ -12827,7 +13023,7 @@ static int __pyx_pw_5_cdec_7Lattice_7__setitem__(PyObject *__pyx_v_self, PyObjec
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/lattice.pxi":35
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":35
* return tuple(arcs)
*
* def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<<
@@ -12860,7 +13056,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/home/cdyer/cdec/python/src/lattice.pxi":36
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":36
*
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -12875,7 +13071,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
__pyx_t_3 = (!__pyx_t_1);
if (__pyx_t_3) {
- /* "/home/cdyer/cdec/python/src/lattice.pxi":37
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":37
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
@@ -12891,7 +13087,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":39
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":39
* raise IndexError('lattice index out of range')
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs: # <<<<<<<<<<<<<<
@@ -12899,29 +13095,35 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
* label = label.encode('utf8')
*/
if (unlikely(((PyObject *)__pyx_v_arcs) == Py_None)) {
- PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
+ {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_4 = ((PyObject *)__pyx_v_arcs); __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
for (;;) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++;
+ #else
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
PyObject* sequence = __pyx_t_5;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 3)) {
+ if (size > 3) __Pyx_RaiseTooManyValuesError(3);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ #if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
- if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
- else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
__pyx_t_8 = PyTuple_GET_ITEM(sequence, 2);
} else {
- if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
- if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
- else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_6 = PyList_GET_ITEM(sequence, 0);
__pyx_t_7 = PyList_GET_ITEM(sequence, 1);
__pyx_t_8 = PyList_GET_ITEM(sequence, 2);
@@ -12929,8 +13131,14 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
__Pyx_INCREF(__pyx_t_6);
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(__pyx_t_8);
+ #else
+ __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- } else {
+ } else
+ {
Py_ssize_t index = -1;
__pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
@@ -12943,12 +13151,13 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
index = 2; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_8);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = NULL;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
goto __pyx_L7_unpacking_done;
__pyx_L6_unpacking_failed:;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
- if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+ __pyx_t_10 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
@@ -12962,7 +13171,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
__pyx_v_dist2next = __pyx_t_8;
__pyx_t_8 = 0;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":40
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":40
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs:
* if isinstance(label, unicode): # <<<<<<<<<<<<<<
@@ -12975,7 +13184,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_3) {
- /* "/home/cdyer/cdec/python/src/lattice.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":41
* for (label, cost, dist2next) in arcs:
* if isinstance(label, unicode):
* label = label.encode('utf8') # <<<<<<<<<<<<<<
@@ -12994,7 +13203,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
}
__pyx_L8:;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":42
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":42
* if isinstance(label, unicode):
* label = label.encode('utf8')
* arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next) # <<<<<<<<<<<<<<
@@ -13006,7 +13215,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
__pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_dist2next); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_arc = new LatticeArc(TD::Convert(((char *)__pyx_t_11)), __pyx_t_12, __pyx_t_13);
- /* "/home/cdyer/cdec/python/src/lattice.pxi":43
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":43
* label = label.encode('utf8')
* arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next)
* self.lattice[0][index].push_back(arc[0]) # <<<<<<<<<<<<<<
@@ -13015,7 +13224,7 @@ static int __pyx_pf_5_cdec_7Lattice_6__setitem__(struct __pyx_obj_5_cdec_Lattice
*/
((__pyx_v_self->lattice[0])[__pyx_v_index]).push_back((__pyx_v_arc[0]));
- /* "/home/cdyer/cdec/python/src/lattice.pxi":44
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":44
* arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next)
* self.lattice[0][index].push_back(arc[0])
* del arc # <<<<<<<<<<<<<<
@@ -13056,7 +13265,7 @@ static Py_ssize_t __pyx_pw_5_cdec_7Lattice_9__len__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/lattice.pxi":46
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":46
* del arc
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -13069,7 +13278,7 @@ static Py_ssize_t __pyx_pf_5_cdec_7Lattice_8__len__(struct __pyx_obj_5_cdec_Latt
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/home/cdyer/cdec/python/src/lattice.pxi":47
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":47
*
* def __len__(self):
* return self.lattice.size() # <<<<<<<<<<<<<<
@@ -13096,7 +13305,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_11__str__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/lattice.pxi":49
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":49
* return self.lattice.size()
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -13113,7 +13322,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_10__str__(struct __pyx_obj_5_cdec_Latt
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/home/cdyer/cdec/python/src/lattice.pxi":50
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":50
*
* def __str__(self):
* return hypergraph.AsPLF(self.lattice[0], True).c_str() # <<<<<<<<<<<<<<
@@ -13151,7 +13360,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_13__iter__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/lattice.pxi":52
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":52
* return hypergraph.AsPLF(self.lattice[0], True).c_str()
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -13214,7 +13423,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_14generator14(__pyx_GeneratorObject *_
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/lattice.pxi":54
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":54
* def __iter__(self):
* cdef unsigned i
* for i in range(len(self)): # <<<<<<<<<<<<<<
@@ -13225,7 +13434,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_14generator14(__pyx_GeneratorObject *_
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":55
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":55
* cdef unsigned i
* for i in range(len(self)):
* yield self[i] # <<<<<<<<<<<<<<
@@ -13256,6 +13465,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_14generator14(__pyx_GeneratorObject *_
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -13279,13 +13489,12 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CY
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("lines (wrapper)", 0);
- __pyx_self = __pyx_self;
__pyx_r = __pyx_pf_5_cdec_7Lattice_5todot_lines(__pyx_self);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/lattice.pxi":58
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
*
* def todot(self):
* def lines(): # <<<<<<<<<<<<<<
@@ -13362,7 +13571,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/lattice.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":59
* def todot(self):
* def lines():
* yield 'digraph lattice {' # <<<<<<<<<<<<<<
@@ -13379,7 +13588,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_L4_resume_from_yield:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/lattice.pxi":60
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":60
* def lines():
* yield 'digraph lattice {'
* yield 'rankdir = LR;' # <<<<<<<<<<<<<<
@@ -13396,7 +13605,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_L5_resume_from_yield:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/lattice.pxi":61
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":61
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
* yield 'node [shape=circle];' # <<<<<<<<<<<<<<
@@ -13413,7 +13622,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_L6_resume_from_yield:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/lattice.pxi":62
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":62
* yield 'rankdir = LR;'
* yield 'node [shape=circle];'
* for i in range(len(self)): # <<<<<<<<<<<<<<
@@ -13447,10 +13656,18 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
for (;;) {
if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) {
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_1 = __pyx_t_4(__pyx_t_3);
if (unlikely(!__pyx_t_1)) {
@@ -13468,7 +13685,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_cur_scope->__pyx_v_i = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":63
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63
* yield 'node [shape=circle];'
* for i in range(len(self)):
* for label, weight, delta in self[i]: # <<<<<<<<<<<<<<
@@ -13489,10 +13706,18 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
for (;;) {
if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) {
if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) {
if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_1 = __pyx_t_7(__pyx_t_5);
if (unlikely(!__pyx_t_1)) {
@@ -13506,21 +13731,22 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
}
if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
PyObject* sequence = __pyx_t_1;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 3)) {
+ if (size > 3) __Pyx_RaiseTooManyValuesError(3);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ #if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
- if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
- else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
__pyx_t_10 = PyTuple_GET_ITEM(sequence, 2);
} else {
- if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
- if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
- else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_8 = PyList_GET_ITEM(sequence, 0);
__pyx_t_9 = PyList_GET_ITEM(sequence, 1);
__pyx_t_10 = PyList_GET_ITEM(sequence, 2);
@@ -13528,8 +13754,14 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__Pyx_INCREF(__pyx_t_8);
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(__pyx_t_10);
+ #else
+ __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- } else {
+ } else
+ {
Py_ssize_t index = -1;
__pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
@@ -13542,12 +13774,13 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
index = 2; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(__pyx_t_10);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = NULL;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L12_unpacking_done;
__pyx_L11_unpacking_failed:;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
- if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+ __pyx_t_12 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L12_unpacking_done:;
}
@@ -13567,7 +13800,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_cur_scope->__pyx_v_delta = __pyx_t_10;
__pyx_t_10 = 0;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":64
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":64
* for i in range(len(self)):
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) # <<<<<<<<<<<<<<
@@ -13627,7 +13860,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":65
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":65
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self) # <<<<<<<<<<<<<<
@@ -13653,7 +13886,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_L14_resume_from_yield:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/lattice.pxi":66
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":66
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self)
* yield '}' # <<<<<<<<<<<<<<
@@ -13682,11 +13915,12 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
-/* "/home/cdyer/cdec/python/src/lattice.pxi":57
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":57
* yield self[i]
*
* def todot(self): # <<<<<<<<<<<<<<
@@ -13716,7 +13950,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_15todot(struct __pyx_obj_5_cdec_Lattic
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/home/cdyer/cdec/python/src/lattice.pxi":58
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
*
* def todot(self):
* def lines(): # <<<<<<<<<<<<<<
@@ -13728,7 +13962,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_15todot(struct __pyx_obj_5_cdec_Lattic
__pyx_v_lines = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/lattice.pxi":67
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":67
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
* return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<<
@@ -13773,7 +14007,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_15todot(struct __pyx_obj_5_cdec_Lattic
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":3
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":3
* cimport mteval
*
* cdef SufficientStats as_stats(x, y): # <<<<<<<<<<<<<<
@@ -13794,7 +14028,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("as_stats", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":4
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":4
*
* cdef SufficientStats as_stats(x, y):
* if isinstance(x, SufficientStats): # <<<<<<<<<<<<<<
@@ -13807,7 +14041,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/home/cdyer/cdec/python/src/mteval.pxi":5
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":5
* cdef SufficientStats as_stats(x, y):
* if isinstance(x, SufficientStats):
* return x # <<<<<<<<<<<<<<
@@ -13822,7 +14056,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
goto __pyx_L3;
}
- /* "/home/cdyer/cdec/python/src/mteval.pxi":6
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":6
* if isinstance(x, SufficientStats):
* return x
* elif x == 0 and isinstance(y, SufficientStats): # <<<<<<<<<<<<<<
@@ -13844,7 +14078,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
}
if (__pyx_t_4) {
- /* "/home/cdyer/cdec/python/src/mteval.pxi":7
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":7
* return x
* elif x == 0 and isinstance(y, SufficientStats):
* stats = SufficientStats() # <<<<<<<<<<<<<<
@@ -13856,7 +14090,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
__pyx_v_stats = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":8
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":8
* elif x == 0 and isinstance(y, SufficientStats):
* stats = SufficientStats()
* stats.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<<
@@ -13865,7 +14099,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
*/
__pyx_v_stats->stats = new SufficientStats();
- /* "/home/cdyer/cdec/python/src/mteval.pxi":9
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":9
* stats = SufficientStats()
* stats.stats = new mteval.SufficientStats()
* stats.metric = (<SufficientStats> y).metric # <<<<<<<<<<<<<<
@@ -13874,7 +14108,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
*/
__pyx_v_stats->metric = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_y)->metric;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":10
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":10
* stats.stats = new mteval.SufficientStats()
* stats.metric = (<SufficientStats> y).metric
* return stats # <<<<<<<<<<<<<<
@@ -13913,7 +14147,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_5words_1__get__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":17
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":17
*
* property words:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -13932,7 +14166,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_5words___get__(struct __pyx_obj_5_cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":18
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":18
* property words:
* def __get__(self):
* return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8') # <<<<<<<<<<<<<<
@@ -13983,7 +14217,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":21
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":21
*
* property fmap:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -14001,7 +14235,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":22
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":22
* property fmap:
* def __get__(self):
* cdef SparseVector fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
@@ -14014,7 +14248,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde
__pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":23
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":23
* def __get__(self):
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) # <<<<<<<<<<<<<<
@@ -14023,7 +14257,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde
*/
__pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_v_self->candidate->fmap);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":24
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":24
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
* return fmap # <<<<<<<<<<<<<<
@@ -14059,7 +14293,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_5score_1__get__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":14
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":14
* cdef class Candidate:
* cdef mteval.const_Candidate* candidate
* cdef public float score # <<<<<<<<<<<<<<
@@ -14135,7 +14369,7 @@ static void __pyx_pw_5_cdec_15SufficientStats_1__dealloc__(PyObject *__pyx_v_sel
__Pyx_RefNannyFinishContext();
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":30
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":30
* cdef mteval.EvaluationMetric* metric
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -14147,7 +14381,7 @@ static void __pyx_pf_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED struct _
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":31
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":31
*
* def __dealloc__(self):
* del self.stats # <<<<<<<<<<<<<<
@@ -14170,7 +14404,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_5score_1__get__(PyObject *__p
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":34
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":34
*
* property score:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -14187,7 +14421,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_5score___get__(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":35
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":35
* property score:
* def __get__(self):
* return self.metric.ComputeScore(self.stats[0]) # <<<<<<<<<<<<<<
@@ -14224,7 +14458,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_6detail_1__get__(PyObject *__
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":38
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":38
*
* property detail:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -14241,7 +14475,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_6detail___get__(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":39
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":39
* property detail:
* def __get__(self):
* return self.metric.DetailedScore(self.stats[0]).c_str() # <<<<<<<<<<<<<<
@@ -14278,7 +14512,7 @@ static Py_ssize_t __pyx_pw_5_cdec_15SufficientStats_3__len__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":41
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":41
* return self.metric.DetailedScore(self.stats[0]).c_str()
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -14291,7 +14525,7 @@ static Py_ssize_t __pyx_pf_5_cdec_15SufficientStats_2__len__(struct __pyx_obj_5_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":42
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":42
*
* def __len__(self):
* return self.stats.size() # <<<<<<<<<<<<<<
@@ -14319,7 +14553,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_5__iter__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":44
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":44
* return self.stats.size()
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -14383,7 +14617,7 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorO
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/mteval.pxi":45
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":45
*
* def __iter__(self):
* for i in range(len(self)): # <<<<<<<<<<<<<<
@@ -14413,10 +14647,18 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorO
for (;;) {
if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) {
if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) {
if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_2 = __pyx_t_4(__pyx_t_3);
if (unlikely(!__pyx_t_2)) {
@@ -14434,7 +14676,7 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorO
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":46
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":46
* def __iter__(self):
* for i in range(len(self)):
* yield self[i] # <<<<<<<<<<<<<<
@@ -14472,6 +14714,7 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorO
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -14497,7 +14740,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_8__getitem__(PyObject *__pyx_
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":48
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":48
* yield self[i]
*
* def __getitem__(self, int index): # <<<<<<<<<<<<<<
@@ -14517,7 +14760,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":49
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":49
*
* def __getitem__(self, int index):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -14532,7 +14775,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj
__pyx_t_3 = (!__pyx_t_1);
if (__pyx_t_3) {
- /* "/home/cdyer/cdec/python/src/mteval.pxi":50
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":50
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<<
@@ -14548,7 +14791,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":51
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":51
* if not 0 <= index < len(self):
* raise IndexError('sufficient stats vector index out of range')
* return self.stats[0][index] # <<<<<<<<<<<<<<
@@ -14590,7 +14833,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_10__iadd__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":53
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":53
* return self.stats[0][index]
*
* def __iadd__(SufficientStats self, SufficientStats other): # <<<<<<<<<<<<<<
@@ -14603,7 +14846,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_5_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iadd__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":54
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":54
*
* def __iadd__(SufficientStats self, SufficientStats other):
* self.stats[0] += other.stats[0] # <<<<<<<<<<<<<<
@@ -14612,7 +14855,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_5_
*/
(__pyx_v_self->stats[0]) += (__pyx_v_other->stats[0]);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":55
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":55
* def __iadd__(SufficientStats self, SufficientStats other):
* self.stats[0] += other.stats[0]
* return self # <<<<<<<<<<<<<<
@@ -14642,7 +14885,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_12__add__(PyObject *__pyx_v_x
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":57
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":57
* return self
*
* def __add__(x, y): # <<<<<<<<<<<<<<
@@ -14662,7 +14905,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__add__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":58
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":58
*
* def __add__(x, y):
* cdef SufficientStats sx = as_stats(x, y) # <<<<<<<<<<<<<<
@@ -14674,7 +14917,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
__pyx_v_sx = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":59
* def __add__(x, y):
* cdef SufficientStats sx = as_stats(x, y)
* cdef SufficientStats sy = as_stats(y, x) # <<<<<<<<<<<<<<
@@ -14686,7 +14929,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
__pyx_v_sy = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":60
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":60
* cdef SufficientStats sx = as_stats(x, y)
* cdef SufficientStats sy = as_stats(y, x)
* cdef SufficientStats result = SufficientStats() # <<<<<<<<<<<<<<
@@ -14698,7 +14941,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
__pyx_v_result = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":61
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":61
* cdef SufficientStats sy = as_stats(y, x)
* cdef SufficientStats result = SufficientStats()
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) # <<<<<<<<<<<<<<
@@ -14707,7 +14950,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
*/
__pyx_v_result->stats = new SufficientStats(operator+((__pyx_v_sx->stats[0]), (__pyx_v_sy->stats[0])));
- /* "/home/cdyer/cdec/python/src/mteval.pxi":62
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":62
* cdef SufficientStats result = SufficientStats()
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
* result.metric = sx.metric # <<<<<<<<<<<<<<
@@ -14716,7 +14959,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
*/
__pyx_v_result->metric = __pyx_v_sx->metric;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":63
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":63
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
* result.metric = sx.metric
* return result # <<<<<<<<<<<<<<
@@ -14747,11 +14990,11 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x
static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_evaluator = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__evaluator,0};
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__evaluator,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -14764,8 +15007,7 @@ static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyO
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__evaluator);
- if (likely(values[0])) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__evaluator)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
@@ -14796,7 +15038,7 @@ static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyO
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":70
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":70
* cdef mteval.CandidateSet* cs
*
* def __cinit__(self, SegmentEvaluator evaluator): # <<<<<<<<<<<<<<
@@ -14809,7 +15051,7 @@ static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_Cand
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":71
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":71
*
* def __cinit__(self, SegmentEvaluator evaluator):
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) # <<<<<<<<<<<<<<
@@ -14818,7 +15060,7 @@ static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_Cand
*/
__pyx_v_self->scorer = new boost::shared_ptr<SegmentEvaluator>((__pyx_v_evaluator->scorer[0]));
- /* "/home/cdyer/cdec/python/src/mteval.pxi":72
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":72
* def __cinit__(self, SegmentEvaluator evaluator):
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
* self.metric = evaluator.metric # <<<<<<<<<<<<<<
@@ -14827,7 +15069,7 @@ static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_Cand
*/
__pyx_v_self->metric = __pyx_v_evaluator->metric;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":73
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":73
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
* self.metric = evaluator.metric
* self.cs = new mteval.CandidateSet() # <<<<<<<<<<<<<<
@@ -14850,7 +15092,7 @@ static void __pyx_pw_5_cdec_12CandidateSet_3__dealloc__(PyObject *__pyx_v_self)
__Pyx_RefNannyFinishContext();
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":75
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":75
* self.cs = new mteval.CandidateSet()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -14862,7 +15104,7 @@ static void __pyx_pf_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":76
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":76
*
* def __dealloc__(self):
* del self.scorer # <<<<<<<<<<<<<<
@@ -14871,7 +15113,7 @@ static void __pyx_pf_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __p
*/
delete __pyx_v_self->scorer;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":77
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":77
* def __dealloc__(self):
* del self.scorer
* del self.cs # <<<<<<<<<<<<<<
@@ -14894,7 +15136,7 @@ static Py_ssize_t __pyx_pw_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":79
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":79
* del self.cs
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -14907,7 +15149,7 @@ static Py_ssize_t __pyx_pf_5_cdec_12CandidateSet_4__len__(struct __pyx_obj_5_cde
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":80
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":80
*
* def __len__(self):
* return self.cs.size() # <<<<<<<<<<<<<<
@@ -14944,7 +15186,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":82
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":82
* return self.cs.size()
*
* def __getitem__(self,int k): # <<<<<<<<<<<<<<
@@ -14964,7 +15206,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":83
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":83
*
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size(): # <<<<<<<<<<<<<<
@@ -14978,7 +15220,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
__pyx_t_2 = (!__pyx_t_1);
if (__pyx_t_2) {
- /* "/home/cdyer/cdec/python/src/mteval.pxi":84
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":84
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<<
@@ -14994,7 +15236,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":85
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":85
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range')
* cdef Candidate candidate = Candidate() # <<<<<<<<<<<<<<
@@ -15006,7 +15248,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
__pyx_v_candidate = ((struct __pyx_obj_5_cdec_Candidate *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":86
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":86
* raise IndexError('candidate set index out of range')
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k] # <<<<<<<<<<<<<<
@@ -15015,7 +15257,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
*/
__pyx_v_candidate->candidate = (&((__pyx_v_self->cs[0])[__pyx_v_k]));
- /* "/home/cdyer/cdec/python/src/mteval.pxi":87
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":87
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k]
* candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats) # <<<<<<<<<<<<<<
@@ -15024,7 +15266,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
*/
__pyx_v_candidate->score = __pyx_v_self->metric->ComputeScore(((__pyx_v_self->cs[0])[__pyx_v_k]).eval_feats);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":88
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":88
* candidate.candidate = &self.cs[0][k]
* candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats)
* return candidate # <<<<<<<<<<<<<<
@@ -15061,7 +15303,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":90
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":90
* return candidate
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -15124,7 +15366,7 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObj
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/mteval.pxi":92
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":92
* def __iter__(self):
* cdef unsigned i
* for i in range(len(self)): # <<<<<<<<<<<<<<
@@ -15135,7 +15377,7 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObj
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":93
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":93
* cdef unsigned i
* for i in range(len(self)):
* yield self[i] # <<<<<<<<<<<<<<
@@ -15166,6 +15408,7 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObj
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -15175,11 +15418,11 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_se
static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_hypergraph = 0;
unsigned int __pyx_v_k;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__hypergraph,&__pyx_n_s__k,0};
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("add_kbest (wrapper)", 0);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__hypergraph,&__pyx_n_s__k,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -15193,12 +15436,10 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_se
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hypergraph);
- if (likely(values[0])) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hypergraph)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k);
- if (likely(values[1])) kw_args--;
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
@@ -15233,7 +15474,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":95
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":95
* yield self[i]
*
* def add_kbest(self, Hypergraph hypergraph, unsigned k): # <<<<<<<<<<<<<<
@@ -15246,7 +15487,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_11add_kbest(struct __pyx_obj_5_c
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("add_kbest", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":96
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":96
*
* def add_kbest(self, Hypergraph hypergraph, unsigned k):
* self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get()) # <<<<<<<<<<<<<<
@@ -15270,7 +15511,7 @@ static void __pyx_pw_5_cdec_16SegmentEvaluator_1__dealloc__(PyObject *__pyx_v_se
__Pyx_RefNannyFinishContext();
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":102
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":102
* cdef mteval.EvaluationMetric* metric
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -15282,7 +15523,7 @@ static void __pyx_pf_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED struct
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":103
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":103
*
* def __dealloc__(self):
* del self.scorer # <<<<<<<<<<<<<<
@@ -15305,7 +15546,7 @@ static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_3evaluate(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":105
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":105
* del self.scorer
*
* def evaluate(self, sentence): # <<<<<<<<<<<<<<
@@ -15325,7 +15566,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("evaluate", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":107
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":107
* def evaluate(self, sentence):
* cdef vector[WordID] hyp
* cdef SufficientStats sf = SufficientStats() # <<<<<<<<<<<<<<
@@ -15337,7 +15578,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
__pyx_v_sf = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":108
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":108
* cdef vector[WordID] hyp
* cdef SufficientStats sf = SufficientStats()
* sf.metric = self.metric # <<<<<<<<<<<<<<
@@ -15346,7 +15587,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
*/
__pyx_v_sf->metric = __pyx_v_self->metric;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":109
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":109
* cdef SufficientStats sf = SufficientStats()
* sf.metric = self.metric
* sf.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<<
@@ -15355,7 +15596,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
*/
__pyx_v_sf->stats = new SufficientStats();
- /* "/home/cdyer/cdec/python/src/mteval.pxi":110
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":110
* sf.metric = self.metric
* sf.stats = new mteval.SufficientStats()
* ConvertSentence(string(as_str(sentence.strip())), &hyp) # <<<<<<<<<<<<<<
@@ -15370,7 +15611,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
TD::ConvertSentence(std::string(__pyx_f_5_cdec_as_str(__pyx_t_2, NULL)), (&__pyx_v_hyp));
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":111
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":111
* sf.stats = new mteval.SufficientStats()
* ConvertSentence(string(as_str(sentence.strip())), &hyp)
* self.scorer.get().Evaluate(hyp, sf.stats) # <<<<<<<<<<<<<<
@@ -15379,7 +15620,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
*/
__pyx_v_self->scorer->get()->Evaluate(__pyx_v_hyp, __pyx_v_sf->stats);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":112
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":112
* ConvertSentence(string(as_str(sentence.strip())), &hyp)
* self.scorer.get().Evaluate(hyp, sf.stats)
* return sf # <<<<<<<<<<<<<<
@@ -15416,7 +15657,7 @@ static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_5candidate_set(PyObject *__p
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":114
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":114
* return sf
*
* def candidate_set(self): # <<<<<<<<<<<<<<
@@ -15434,7 +15675,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("candidate_set", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":115
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":115
*
* def candidate_set(self):
* return CandidateSet(self) # <<<<<<<<<<<<<<
@@ -15471,14 +15712,14 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_
static int __pyx_pw_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_name = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0};
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0};
PyObject* values[1] = {0};
- /* "/home/cdyer/cdec/python/src/mteval.pxi":121
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":121
* cdef mteval.EvaluationMetric* metric
*
* def __cinit__(self, bytes name=None): # <<<<<<<<<<<<<<
@@ -15542,7 +15783,7 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":122
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":122
*
* def __cinit__(self, bytes name=None):
* if name: # <<<<<<<<<<<<<<
@@ -15552,7 +15793,7 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p
__pyx_t_1 = (((PyObject *)__pyx_v_name) != Py_None) && (PyBytes_GET_SIZE(((PyObject *)__pyx_v_name)) != 0);
if (__pyx_t_1) {
- /* "/home/cdyer/cdec/python/src/mteval.pxi":123
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":123
* def __cinit__(self, bytes name=None):
* if name:
* self.name = new string(name) # <<<<<<<<<<<<<<
@@ -15562,7 +15803,7 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p
__pyx_t_2 = PyBytes_AsString(((PyObject *)__pyx_v_name)); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->name = new std::string(__pyx_t_2);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":124
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":124
* if name:
* self.name = new string(name)
* self.metric = mteval.MetricInstance(self.name[0]) # <<<<<<<<<<<<<<
@@ -15593,7 +15834,7 @@ static void __pyx_pw_5_cdec_6Scorer_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":126
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":126
* self.metric = mteval.MetricInstance(self.name[0])
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -15605,7 +15846,7 @@ static void __pyx_pf_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":127
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":127
*
* def __dealloc__(self):
* del self.name # <<<<<<<<<<<<<<
@@ -15621,11 +15862,11 @@ static void __pyx_pf_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_
static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_refs = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__refs,0};
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__refs,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -15638,8 +15879,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObj
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs);
- if (likely(values[0])) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
@@ -15665,7 +15905,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":129
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":129
* del self.name
*
* def __call__(self, refs): # <<<<<<<<<<<<<<
@@ -15694,7 +15934,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
__Pyx_RefNannySetupContext("__call__", 0);
__Pyx_INCREF(__pyx_v_refs);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":130
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":130
*
* def __call__(self, refs):
* if isinstance(refs, unicode) or isinstance(refs, str): # <<<<<<<<<<<<<<
@@ -15716,7 +15956,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
}
if (__pyx_t_4) {
- /* "/home/cdyer/cdec/python/src/mteval.pxi":131
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":131
* def __call__(self, refs):
* if isinstance(refs, unicode) or isinstance(refs, str):
* refs = [refs] # <<<<<<<<<<<<<<
@@ -15735,7 +15975,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
}
__pyx_L3:;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":132
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":132
* if isinstance(refs, unicode) or isinstance(refs, str):
* refs = [refs]
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() # <<<<<<<<<<<<<<
@@ -15744,7 +15984,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
__pyx_v_refsv = new std::vector<std::vector<WordID> >();
- /* "/home/cdyer/cdec/python/src/mteval.pxi":135
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":135
* cdef vector[WordID]* refv
* cdef bytes ref_str
* for ref in refs: # <<<<<<<<<<<<<<
@@ -15762,10 +16002,18 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
for (;;) {
if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
+ #else
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
+ #else
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_7 = __pyx_t_6(__pyx_t_1);
if (unlikely(!__pyx_t_7)) {
@@ -15781,7 +16029,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
__pyx_v_ref = __pyx_t_7;
__pyx_t_7 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":136
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":136
* cdef bytes ref_str
* for ref in refs:
* refv = new vector[WordID]() # <<<<<<<<<<<<<<
@@ -15790,7 +16038,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
__pyx_v_refv = new std::vector<WordID>();
- /* "/home/cdyer/cdec/python/src/mteval.pxi":137
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":137
* for ref in refs:
* refv = new vector[WordID]()
* ConvertSentence(string(as_str(ref.strip())), refv) # <<<<<<<<<<<<<<
@@ -15805,7 +16053,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
TD::ConvertSentence(std::string(__pyx_f_5_cdec_as_str(__pyx_t_8, NULL)), __pyx_v_refv);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":138
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":138
* refv = new vector[WordID]()
* ConvertSentence(string(as_str(ref.strip())), refv)
* refsv.push_back(refv[0]) # <<<<<<<<<<<<<<
@@ -15814,7 +16062,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
__pyx_v_refsv->push_back((__pyx_v_refv[0]));
- /* "/home/cdyer/cdec/python/src/mteval.pxi":139
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":139
* ConvertSentence(string(as_str(ref.strip())), refv)
* refsv.push_back(refv[0])
* del refv # <<<<<<<<<<<<<<
@@ -15825,7 +16073,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":141
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":141
* del refv
* cdef unsigned i
* cdef SegmentEvaluator evaluator = SegmentEvaluator() # <<<<<<<<<<<<<<
@@ -15837,7 +16085,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
__pyx_v_evaluator = ((struct __pyx_obj_5_cdec_SegmentEvaluator *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":142
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":142
* cdef unsigned i
* cdef SegmentEvaluator evaluator = SegmentEvaluator()
* evaluator.metric = self.metric # <<<<<<<<<<<<<<
@@ -15846,7 +16094,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
__pyx_v_evaluator->metric = __pyx_v_self->metric;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":143
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":143
* cdef SegmentEvaluator evaluator = SegmentEvaluator()
* evaluator.metric = self.metric
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator]( # <<<<<<<<<<<<<<
@@ -15855,7 +16103,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
__pyx_v_evaluator->scorer = new boost::shared_ptr<SegmentEvaluator>(__pyx_v_self->metric->CreateSegmentEvaluator((__pyx_v_refsv[0])));
- /* "/home/cdyer/cdec/python/src/mteval.pxi":145
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":145
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator](
* self.metric.CreateSegmentEvaluator(refsv[0]))
* del refsv # in theory should not delete but store in SegmentEvaluator # <<<<<<<<<<<<<<
@@ -15864,7 +16112,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
delete __pyx_v_refsv;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":146
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":146
* self.metric.CreateSegmentEvaluator(refsv[0]))
* del refsv # in theory should not delete but store in SegmentEvaluator
* return evaluator # <<<<<<<<<<<<<<
@@ -15904,7 +16152,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":148
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":148
* return evaluator
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -15921,7 +16169,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":149
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":149
*
* def __str__(self):
* return self.name.c_str() # <<<<<<<<<<<<<<
@@ -15947,7 +16195,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":151
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":151
* return self.name.c_str()
*
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): # <<<<<<<<<<<<<<
@@ -15973,7 +16221,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_compute_score", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":152
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":152
*
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats):
* cdef Metric metric = <Metric> metric_ # <<<<<<<<<<<<<<
@@ -15983,7 +16231,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_)));
__pyx_v_metric = ((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":153
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":153
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats):
* cdef Metric metric = <Metric> metric_
* cdef list ss = [] # <<<<<<<<<<<<<<
@@ -15995,7 +16243,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat
__pyx_v_ss = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":155
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":155
* cdef list ss = []
* cdef unsigned i
* for i in range(stats.size()): # <<<<<<<<<<<<<<
@@ -16006,7 +16254,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":156
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":156
* cdef unsigned i
* for i in range(stats.size()):
* ss.append(stats[0][i]) # <<<<<<<<<<<<<<
@@ -16019,7 +16267,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- /* "/home/cdyer/cdec/python/src/mteval.pxi":157
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":157
* for i in range(stats.size()):
* ss.append(stats[0][i])
* return metric.score(ss) # <<<<<<<<<<<<<<
@@ -16057,7 +16305,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":159
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":159
* return metric.score(ss)
*
* cdef void _compute_sufficient_stats(void* metric_, # <<<<<<<<<<<<<<
@@ -16084,7 +16332,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_compute_sufficient_stats", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":163
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":163
* vector[string]* refs,
* mteval.SufficientStats* out):
* cdef Metric metric = <Metric> metric_ # <<<<<<<<<<<<<<
@@ -16094,7 +16342,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_)));
__pyx_v_metric = ((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":164
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":164
* mteval.SufficientStats* out):
* cdef Metric metric = <Metric> metric_
* cdef list refs_ = [] # <<<<<<<<<<<<<<
@@ -16106,7 +16354,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
__pyx_v_refs_ = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":166
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":166
* cdef list refs_ = []
* cdef unsigned i
* for i in range(refs.size()): # <<<<<<<<<<<<<<
@@ -16117,7 +16365,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":167
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":167
* cdef unsigned i
* for i in range(refs.size()):
* refs_.append(refs[0][i].c_str()) # <<<<<<<<<<<<<<
@@ -16130,7 +16378,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
}
- /* "/home/cdyer/cdec/python/src/mteval.pxi":168
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":168
* for i in range(refs.size()):
* refs_.append(refs[0][i].c_str())
* cdef list ss = metric.evaluate(hyp.c_str(), refs_) # <<<<<<<<<<<<<<
@@ -16157,7 +16405,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
__pyx_v_ss = ((PyObject*)__pyx_t_5);
__pyx_t_5 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":169
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":169
* refs_.append(refs[0][i].c_str())
* cdef list ss = metric.evaluate(hyp.c_str(), refs_)
* out.fields.resize(len(ss)) # <<<<<<<<<<<<<<
@@ -16165,12 +16413,13 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
* out.fields[i] = ss[i]
*/
if (unlikely(((PyObject *)__pyx_v_ss) == Py_None)) {
- PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_7 = PyList_GET_SIZE(((PyObject *)__pyx_v_ss));
+ __pyx_t_7 = PyList_GET_SIZE(((PyObject *)__pyx_v_ss)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_out->fields.resize(__pyx_t_7);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":170
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":170
* cdef list ss = metric.evaluate(hyp.c_str(), refs_)
* out.fields.resize(len(ss))
* for i in range(len(ss)): # <<<<<<<<<<<<<<
@@ -16178,19 +16427,24 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std:
*
*/
if (unlikely(((PyObject *)__pyx_v_ss) == Py_None)) {
- PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_7 = PyList_GET_SIZE(((PyObject *)__pyx_v_ss));
+ __pyx_t_7 = PyList_GET_SIZE(((PyObject *)__pyx_v_ss)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_7; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":171
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":171
* out.fields.resize(len(ss))
* for i in range(len(ss)):
* out.fields[i] = ss[i] # <<<<<<<<<<<<<<
*
* cdef class Metric:
*/
+ if (unlikely(((PyObject *)__pyx_v_ss) == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_ss), __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_5); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -16225,7 +16479,7 @@ static int __pyx_pw_5_cdec_6Metric_1__cinit__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":175
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":175
* cdef class Metric:
* cdef Scorer scorer
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -16243,7 +16497,7 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":176
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":176
* cdef Scorer scorer
* def __cinit__(self):
* self.scorer = Scorer() # <<<<<<<<<<<<<<
@@ -16258,7 +16512,7 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p
__pyx_v_self->scorer = ((struct __pyx_obj_5_cdec_Scorer *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":177
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":177
* def __cinit__(self):
* self.scorer = Scorer()
* self.scorer.name = new string(as_str(self.__class__.__name__)) # <<<<<<<<<<<<<<
@@ -16273,7 +16527,7 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p
__pyx_v_self->scorer->name = new std::string(__pyx_f_5_cdec_as_str(__pyx_t_2, NULL));
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":178
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":178
* self.scorer = Scorer()
* self.scorer.name = new string(as_str(self.__class__.__name__))
* self.scorer.metric = mteval.PyMetricInstance(self.scorer.name[0], # <<<<<<<<<<<<<<
@@ -16298,11 +16552,11 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p
static PyObject *__pyx_pw_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_refs = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__refs,0};
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__refs,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -16315,8 +16569,7 @@ static PyObject *__pyx_pw_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObj
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs);
- if (likely(values[0])) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
@@ -16342,7 +16595,7 @@ static PyObject *__pyx_pw_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":181
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":181
* <void*> self, _compute_sufficient_stats, _compute_score)
*
* def __call__(self, refs): # <<<<<<<<<<<<<<
@@ -16360,7 +16613,7 @@ static PyObject *__pyx_pf_5_cdec_6Metric_2__call__(struct __pyx_obj_5_cdec_Metri
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__call__", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":182
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":182
*
* def __call__(self, refs):
* return self.scorer(refs) # <<<<<<<<<<<<<<
@@ -16404,7 +16657,7 @@ static PyObject *__pyx_pw_5_cdec_6Metric_5score(PyObject *__pyx_v_stats, CYTHON_
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":184
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":184
* return self.scorer(refs)
*
* def score(SufficientStats stats): # <<<<<<<<<<<<<<
@@ -16417,7 +16670,7 @@ static PyObject *__pyx_pf_5_cdec_6Metric_4score(CYTHON_UNUSED struct __pyx_obj_5
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("score", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":185
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":185
*
* def score(SufficientStats stats):
* return 0 # <<<<<<<<<<<<<<
@@ -16441,11 +16694,11 @@ static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObj
static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
CYTHON_UNUSED PyObject *__pyx_v_hyp = 0;
CYTHON_UNUSED PyObject *__pyx_v_refs = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__hyp,&__pyx_n_s__refs,0};
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__hyp,&__pyx_n_s__refs,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -16459,12 +16712,10 @@ static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObj
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hyp);
- if (likely(values[0])) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hyp)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs);
- if (likely(values[1])) kw_args--;
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
@@ -16494,7 +16745,7 @@ static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/home/cdyer/cdec/python/src/mteval.pxi":187
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":187
* return 0
*
* def evaluate(self, hyp, refs): # <<<<<<<<<<<<<<
@@ -16511,7 +16762,7 @@ static PyObject *__pyx_pf_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __pyx_ob
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("evaluate", 0);
- /* "/home/cdyer/cdec/python/src/mteval.pxi":188
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":188
*
* def evaluate(self, hyp, refs):
* return [] # <<<<<<<<<<<<<<
@@ -16536,17 +16787,15 @@ static PyObject *__pyx_pf_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __pyx_ob
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_3_make_config(PyObject *__pyx_self, PyObject *__pyx_v_config); /*proto*/
-static PyMethodDef __pyx_mdef_5_cdec_3_make_config = {__Pyx_NAMESTR("_make_config"), (PyCFunction)__pyx_pw_5_cdec_3_make_config, METH_O, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_5_cdec_3_make_config(PyObject *__pyx_self, PyObject *__pyx_v_config) {
+static PyObject *__pyx_pw_5_cdec_3set_silent(PyObject *__pyx_self, PyObject *__pyx_v_yn); /*proto*/
+static PyMethodDef __pyx_mdef_5_cdec_3set_silent = {__Pyx_NAMESTR("set_silent"), (PyCFunction)__pyx_pw_5_cdec_3set_silent, METH_O, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5_cdec_3set_silent(PyObject *__pyx_self, PyObject *__pyx_v_yn) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("_make_config (wrapper)", 0);
- __pyx_self = __pyx_self;
- __pyx_r = __pyx_pf_5_cdec_2_make_config(__pyx_self, ((PyObject *)__pyx_v_config));
+ __Pyx_RefNannySetupContext("set_silent (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_2set_silent(__pyx_self, ((PyObject *)__pyx_v_yn));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -16554,12 +16803,63 @@ static PyObject *__pyx_pw_5_cdec_3_make_config(PyObject *__pyx_self, PyObject *_
/* "_cdec.pyx":28
* class ParseFailed(Exception): pass
*
+ * def set_silent(yn): # <<<<<<<<<<<<<<
+ * SetSilent(yn)
+ *
+ */
+
+static PyObject *__pyx_pf_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_yn) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("set_silent", 0);
+
+ /* "_cdec.pyx":29
+ *
+ * def set_silent(yn):
+ * SetSilent(yn) # <<<<<<<<<<<<<<
+ *
+ * def _make_config(config):
+ */
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_yn); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ SetSilent(__pyx_t_1);
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("_cdec.set_silent", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_5_make_config(PyObject *__pyx_self, PyObject *__pyx_v_config); /*proto*/
+static PyMethodDef __pyx_mdef_5_cdec_5_make_config = {__Pyx_NAMESTR("_make_config"), (PyCFunction)__pyx_pw_5_cdec_5_make_config, METH_O, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5_cdec_5_make_config(PyObject *__pyx_self, PyObject *__pyx_v_config) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("_make_config (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_4_make_config(__pyx_self, ((PyObject *)__pyx_v_config));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_cdec.pyx":31
+ * SetSilent(yn)
+ *
* def _make_config(config): # <<<<<<<<<<<<<<
* for key, value in config.items():
* if isinstance(value, dict):
*/
-static PyObject *__pyx_pf_5_cdec_2_make_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config) {
+static PyObject *__pyx_pf_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config) {
struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -16577,7 +16877,7 @@ static PyObject *__pyx_pf_5_cdec_2_make_config(CYTHON_UNUSED PyObject *__pyx_sel
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_config);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_config);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_4generator17, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_6generator17, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -16595,7 +16895,7 @@ static PyObject *__pyx_pf_5_cdec_2_make_config(CYTHON_UNUSED PyObject *__pyx_sel
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
@@ -16623,25 +16923,25 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "_cdec.pyx":29
+ /* "_cdec.pyx":32
*
* def _make_config(config):
* for key, value in config.items(): # <<<<<<<<<<<<<<
* if isinstance(value, dict):
* for name, info in value.items():
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_config, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_config, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
__pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
- __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -16649,16 +16949,24 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
for (;;) {
if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_2 = __pyx_t_4(__pyx_t_1);
if (unlikely(!__pyx_t_2)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -16666,29 +16974,35 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
}
if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
PyObject* sequence = __pyx_t_2;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ #if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
- if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
} else {
- if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
- if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_5 = PyList_GET_ITEM(sequence, 0);
__pyx_t_6 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_6);
+ #else
+ __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- } else {
+ } else
+ {
Py_ssize_t index = -1;
- __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
@@ -16696,14 +17010,15 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
__Pyx_GOTREF(__pyx_t_5);
index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L7_unpacking_done;
__pyx_L6_unpacking_failed:;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
- if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
@@ -16717,7 +17032,7 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
__pyx_cur_scope->__pyx_v_value = __pyx_t_6;
__pyx_t_6 = 0;
- /* "_cdec.pyx":30
+ /* "_cdec.pyx":33
* def _make_config(config):
* for key, value in config.items():
* if isinstance(value, dict): # <<<<<<<<<<<<<<
@@ -16730,23 +17045,23 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_9) {
- /* "_cdec.pyx":31
+ /* "_cdec.pyx":34
* for key, value in config.items():
* if isinstance(value, dict):
* for name, info in value.items(): # <<<<<<<<<<<<<<
* yield key, '%s %s' % (name, info)
* elif isinstance(value, list):
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_value, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_value, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
__pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0;
__pyx_t_11 = NULL;
} else {
- __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext;
}
@@ -16754,16 +17069,24 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
for (;;) {
if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_2)) {
if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++;
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) {
if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++;
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_6 = __pyx_t_11(__pyx_t_2);
if (unlikely(!__pyx_t_6)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -16771,29 +17094,35 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
}
if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
PyObject* sequence = __pyx_t_6;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ #if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
- if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
} else {
- if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
- if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_5 = PyList_GET_ITEM(sequence, 0);
__pyx_t_7 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_7);
+ #else
+ __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- } else {
+ } else
+ {
Py_ssize_t index = -1;
- __pyx_t_12 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_12)->tp_iternext;
@@ -16801,14 +17130,15 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
__Pyx_GOTREF(__pyx_t_5);
index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_12); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(__pyx_t_7);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
goto __pyx_L12_unpacking_done;
__pyx_L11_unpacking_failed:;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
- if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L12_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_name);
@@ -16822,14 +17152,14 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
__pyx_cur_scope->__pyx_v_info = __pyx_t_7;
__pyx_t_7 = 0;
- /* "_cdec.pyx":32
+ /* "_cdec.pyx":35
* if isinstance(value, dict):
* for name, info in value.items():
* yield key, '%s %s' % (name, info) # <<<<<<<<<<<<<<
* elif isinstance(value, list):
* for name in value:
*/
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_name);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_name);
@@ -16837,10 +17167,10 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_info);
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_cur_scope->__pyx_v_info);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_info);
- __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_45), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_45), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_7));
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_key);
@@ -16874,13 +17204,13 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
__pyx_t_4 = __pyx_cur_scope->__pyx_t_3;
__pyx_t_10 = __pyx_cur_scope->__pyx_t_4;
__pyx_t_11 = __pyx_cur_scope->__pyx_t_5;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L8;
}
- /* "_cdec.pyx":33
+ /* "_cdec.pyx":36
* for name, info in value.items():
* yield key, '%s %s' % (name, info)
* elif isinstance(value, list): # <<<<<<<<<<<<<<
@@ -16893,7 +17223,7 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_9) {
- /* "_cdec.pyx":34
+ /* "_cdec.pyx":37
* yield key, '%s %s' % (name, info)
* elif isinstance(value, list):
* for name in value: # <<<<<<<<<<<<<<
@@ -16904,23 +17234,31 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
__pyx_t_2 = __pyx_cur_scope->__pyx_v_value; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0;
__pyx_t_11 = NULL;
} else {
- __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext;
}
for (;;) {
if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_2)) {
if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++;
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) {
if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++;
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_6 = __pyx_t_11(__pyx_t_2);
if (unlikely(!__pyx_t_6)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -16932,14 +17270,14 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
__pyx_cur_scope->__pyx_v_name = __pyx_t_6;
__pyx_t_6 = 0;
- /* "_cdec.pyx":35
+ /* "_cdec.pyx":38
* elif isinstance(value, list):
* for name in value:
* yield key, name # <<<<<<<<<<<<<<
* else:
* yield key, bytes(value)
*/
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_key);
@@ -16973,29 +17311,29 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
__pyx_t_4 = __pyx_cur_scope->__pyx_t_3;
__pyx_t_10 = __pyx_cur_scope->__pyx_t_4;
__pyx_t_11 = __pyx_cur_scope->__pyx_t_5;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L8;
}
/*else*/ {
- /* "_cdec.pyx":37
+ /* "_cdec.pyx":40
* yield key, name
* else:
* yield key, bytes(value) # <<<<<<<<<<<<<<
*
* cdef class Decoder:
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_value);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_value);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value);
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_key);
@@ -17020,7 +17358,7 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
__Pyx_XGOTREF(__pyx_t_1);
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_t_4 = __pyx_cur_scope->__pyx_t_3;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L8:;
}
@@ -17038,6 +17376,7 @@ static PyObject *__pyx_gb_5_cdec_4generator17(__pyx_GeneratorObject *__pyx_gener
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
@@ -17047,16 +17386,16 @@ static int __pyx_pw_5_cdec_7Decoder_1__cinit__(PyObject *__pyx_v_self, PyObject
static int __pyx_pw_5_cdec_7Decoder_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_config_str = 0;
PyObject *__pyx_v_config = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__config_str,0};
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
__pyx_v_config = PyDict_New(); if (unlikely(!__pyx_v_config)) return -1;
__Pyx_GOTREF(__pyx_v_config);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__config_str,0};
PyObject* values[1] = {0};
- /* "_cdec.pyx":43
+ /* "_cdec.pyx":46
* cdef DenseVector weights
*
* def __cinit__(self, config_str=None, **config): # <<<<<<<<<<<<<<
@@ -17081,7 +17420,7 @@ static int __pyx_pw_5_cdec_7Decoder_1__cinit__(PyObject *__pyx_v_self, PyObject
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_config, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_config, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -17094,7 +17433,7 @@ static int __pyx_pw_5_cdec_7Decoder_1__cinit__(PyObject *__pyx_v_self, PyObject
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_CLEAR(__pyx_v_config);
__Pyx_AddTraceback("_cdec.Decoder.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -17108,7 +17447,7 @@ static int __pyx_pw_5_cdec_7Decoder_1__cinit__(PyObject *__pyx_v_self, PyObject
}
static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "_cdec.pyx":54
+/* "_cdec.pyx":57
* 'csplit', 'tagger', 'lexalign'):
* raise InvalidConfig('formalism "%s" unknown' % formalism)
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config)) # <<<<<<<<<<<<<<
@@ -17134,7 +17473,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_9__cinit___genexpr(PyObject *__pyx_sel
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Decoder_9__cinit___2generator21, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Decoder_9__cinit___2generator21, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -17171,16 +17510,16 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator21(__pyx_Generato
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___make_config); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___make_config); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config)) { __Pyx_RaiseClosureNameError("config"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config)) { __Pyx_RaiseClosureNameError("config"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_config);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config);
- __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
@@ -17188,7 +17527,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator21(__pyx_Generato
__pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
}
@@ -17196,16 +17535,24 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator21(__pyx_Generato
for (;;) {
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) {
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
+ #else
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) {
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
+ #else
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_3 = __pyx_t_5(__pyx_t_2);
if (unlikely(!__pyx_t_3)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -17216,7 +17563,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator21(__pyx_Generato
__Pyx_GIVEREF(__pyx_t_3);
__pyx_cur_scope->__pyx_v_kv = __pyx_t_3;
__pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), __pyx_cur_scope->__pyx_v_kv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), __pyx_cur_scope->__pyx_v_kv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_r = ((PyObject *)__pyx_t_3);
__pyx_t_3 = 0;
@@ -17235,7 +17582,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator21(__pyx_Generato
__Pyx_XGOTREF(__pyx_t_2);
__pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
__pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
PyErr_SetNone(PyExc_StopIteration);
@@ -17248,11 +17595,12 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator21(__pyx_Generato
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return NULL;
}
-/* "_cdec.pyx":43
+/* "_cdec.pyx":46
* cdef DenseVector weights
*
* def __cinit__(self, config_str=None, **config): # <<<<<<<<<<<<<<
@@ -17288,7 +17636,7 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_config);
__Pyx_INCREF(__pyx_v_config_str);
- /* "_cdec.pyx":49
+ /* "_cdec.pyx":52
* Decoder(formalism='scfg')
* """
* if config_str is None: # <<<<<<<<<<<<<<
@@ -17298,22 +17646,22 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
__pyx_t_1 = (__pyx_v_config_str == Py_None);
if (__pyx_t_1) {
- /* "_cdec.pyx":50
+ /* "_cdec.pyx":53
* """
* if config_str is None:
* formalism = config.get('formalism', None) # <<<<<<<<<<<<<<
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb',
* 'csplit', 'tagger', 'lexalign'):
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_config, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_config, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_formalism = __pyx_t_3;
__pyx_t_3 = 0;
- /* "_cdec.pyx":51
+ /* "_cdec.pyx":54
* if config_str is None:
* formalism = config.get('formalism', None)
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb', # <<<<<<<<<<<<<<
@@ -17322,39 +17670,39 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
*/
__Pyx_INCREF(__pyx_v_formalism);
__pyx_t_3 = __pyx_v_formalism;
- __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__scfg), Py_NE); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__scfg), Py_NE); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (((int)__pyx_t_1)) {
- __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__fst), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__fst), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_5 = ((int)__pyx_t_4);
} else {
__pyx_t_5 = ((int)__pyx_t_1);
}
if (__pyx_t_5) {
- __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__lextrans), Py_NE); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__lextrans), Py_NE); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = ((int)__pyx_t_1);
} else {
__pyx_t_4 = __pyx_t_5;
}
if (__pyx_t_4) {
- __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__pb), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__pb), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = ((int)__pyx_t_5);
} else {
__pyx_t_1 = __pyx_t_4;
}
if (__pyx_t_1) {
- __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__csplit), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__csplit), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_5 = ((int)__pyx_t_4);
} else {
__pyx_t_5 = __pyx_t_1;
}
if (__pyx_t_5) {
- __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__tagger), Py_NE); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__tagger), Py_NE); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = ((int)__pyx_t_1);
} else {
__pyx_t_4 = __pyx_t_5;
}
if (__pyx_t_4) {
- __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__lexalign), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__lexalign), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = ((int)__pyx_t_5);
} else {
__pyx_t_1 = __pyx_t_4;
@@ -17363,50 +17711,50 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
__pyx_t_4 = __pyx_t_1;
if (__pyx_t_4) {
- /* "_cdec.pyx":53
+ /* "_cdec.pyx":56
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb',
* 'csplit', 'tagger', 'lexalign'):
* raise InvalidConfig('formalism "%s" unknown' % formalism) # <<<<<<<<<<<<<<
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config))
* cdef istringstream* config_stream = new istringstream(config_str)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__InvalidConfig); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__InvalidConfig); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), __pyx_v_formalism); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), __pyx_v_formalism); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
__pyx_L4:;
- /* "_cdec.pyx":54
+ /* "_cdec.pyx":57
* 'csplit', 'tagger', 'lexalign'):
* raise InvalidConfig('formalism "%s" unknown' % formalism)
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config)) # <<<<<<<<<<<<<<
* cdef istringstream* config_stream = new istringstream(config_str)
* self.dec = new decoder.Decoder(config_stream)
*/
- __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_39), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_39), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_6 = __pyx_pf_5_cdec_7Decoder_9__cinit___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __pyx_pf_5_cdec_7Decoder_9__cinit___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
__pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
@@ -17417,17 +17765,17 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
}
__pyx_L3:;
- /* "_cdec.pyx":55
+ /* "_cdec.pyx":58
* raise InvalidConfig('formalism "%s" unknown' % formalism)
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config))
* cdef istringstream* config_stream = new istringstream(config_str) # <<<<<<<<<<<<<<
* self.dec = new decoder.Decoder(config_stream)
* del config_stream
*/
- __pyx_t_7 = PyBytes_AsString(__pyx_v_config_str); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyBytes_AsString(__pyx_v_config_str); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_config_stream = new std::istringstream(__pyx_t_7);
- /* "_cdec.pyx":56
+ /* "_cdec.pyx":59
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config))
* cdef istringstream* config_stream = new istringstream(config_str)
* self.dec = new decoder.Decoder(config_stream) # <<<<<<<<<<<<<<
@@ -17436,7 +17784,7 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
*/
__pyx_v_self->dec = new Decoder(__pyx_v_config_stream);
- /* "_cdec.pyx":57
+ /* "_cdec.pyx":60
* cdef istringstream* config_stream = new istringstream(config_str)
* self.dec = new decoder.Decoder(config_stream)
* del config_stream # <<<<<<<<<<<<<<
@@ -17445,23 +17793,23 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
*/
delete __pyx_v_config_stream;
- /* "_cdec.pyx":58
+ /* "_cdec.pyx":61
* self.dec = new decoder.Decoder(config_stream)
* del config_stream
* self.weights = DenseVector.__new__(DenseVector) # <<<<<<<<<<<<<<
* self.weights.vector = &self.dec.CurrentWeightVector()
* self.weights.owned = True
*/
- __pyx_t_6 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_DenseVector)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5_cdec_DenseVector)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5_cdec_DenseVector)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5_cdec_DenseVector)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GIVEREF(__pyx_t_6);
__Pyx_GOTREF(__pyx_v_self->weights);
__Pyx_DECREF(((PyObject *)__pyx_v_self->weights));
__pyx_v_self->weights = ((struct __pyx_obj_5_cdec_DenseVector *)__pyx_t_6);
__pyx_t_6 = 0;
- /* "_cdec.pyx":59
+ /* "_cdec.pyx":62
* del config_stream
* self.weights = DenseVector.__new__(DenseVector)
* self.weights.vector = &self.dec.CurrentWeightVector() # <<<<<<<<<<<<<<
@@ -17470,7 +17818,7 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
*/
__pyx_v_self->weights->vector = (&__pyx_v_self->dec->CurrentWeightVector());
- /* "_cdec.pyx":60
+ /* "_cdec.pyx":63
* self.weights = DenseVector.__new__(DenseVector)
* self.weights.vector = &self.dec.CurrentWeightVector()
* self.weights.owned = True # <<<<<<<<<<<<<<
@@ -17504,7 +17852,7 @@ static void __pyx_pw_5_cdec_7Decoder_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "_cdec.pyx":62
+/* "_cdec.pyx":65
* self.weights.owned = True
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -17516,7 +17864,7 @@ static void __pyx_pf_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __pyx_obj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "_cdec.pyx":63
+ /* "_cdec.pyx":66
*
* def __dealloc__(self):
* del self.dec # <<<<<<<<<<<<<<
@@ -17539,7 +17887,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7weights_1__get__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "_cdec.pyx":66
+/* "_cdec.pyx":69
*
* property weights:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -17552,7 +17900,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_7weights___get__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
- /* "_cdec.pyx":67
+ /* "_cdec.pyx":70
* property weights:
* def __get__(self):
* return self.weights # <<<<<<<<<<<<<<
@@ -17582,7 +17930,7 @@ static int __pyx_pw_5_cdec_7Decoder_7weights_3__set__(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "_cdec.pyx":69
+/* "_cdec.pyx":72
* return self.weights
*
* def __set__(self, weights): # <<<<<<<<<<<<<<
@@ -17609,7 +17957,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "_cdec.pyx":70
+ /* "_cdec.pyx":73
*
* def __set__(self, weights):
* if isinstance(weights, DenseVector): # <<<<<<<<<<<<<<
@@ -17622,7 +17970,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "_cdec.pyx":71
+ /* "_cdec.pyx":74
* def __set__(self, weights):
* if isinstance(weights, DenseVector):
* self.weights.vector[0] = (<DenseVector> weights).vector[0] # <<<<<<<<<<<<<<
@@ -17633,7 +17981,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
goto __pyx_L3;
}
- /* "_cdec.pyx":72
+ /* "_cdec.pyx":75
* if isinstance(weights, DenseVector):
* self.weights.vector[0] = (<DenseVector> weights).vector[0]
* elif isinstance(weights, SparseVector): # <<<<<<<<<<<<<<
@@ -17646,7 +17994,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "_cdec.pyx":73
+ /* "_cdec.pyx":76
* self.weights.vector[0] = (<DenseVector> weights).vector[0]
* elif isinstance(weights, SparseVector):
* self.weights.vector.clear() # <<<<<<<<<<<<<<
@@ -17655,7 +18003,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
*/
__pyx_v_self->weights->vector->clear();
- /* "_cdec.pyx":74
+ /* "_cdec.pyx":77
* elif isinstance(weights, SparseVector):
* self.weights.vector.clear()
* ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector) # <<<<<<<<<<<<<<
@@ -17666,7 +18014,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
goto __pyx_L3;
}
- /* "_cdec.pyx":75
+ /* "_cdec.pyx":78
* self.weights.vector.clear()
* ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector)
* elif isinstance(weights, dict): # <<<<<<<<<<<<<<
@@ -17679,7 +18027,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "_cdec.pyx":76
+ /* "_cdec.pyx":79
* ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector)
* elif isinstance(weights, dict):
* self.weights.vector.clear() # <<<<<<<<<<<<<<
@@ -17688,23 +18036,23 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
*/
__pyx_v_self->weights->vector->clear();
- /* "_cdec.pyx":77
+ /* "_cdec.pyx":80
* elif isinstance(weights, dict):
* self.weights.vector.clear()
* for fname, fval in weights.items(): # <<<<<<<<<<<<<<
* self.weights[fname] = fval
* else:
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
__pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -17712,16 +18060,24 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
for (;;) {
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
+ #else
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
+ #else
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #endif
} else {
__pyx_t_3 = __pyx_t_5(__pyx_t_1);
if (unlikely(!__pyx_t_3)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -17729,29 +18085,35 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
}
if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
PyObject* sequence = __pyx_t_3;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ #if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
- if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
} else {
- if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
- if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
__pyx_t_6 = PyList_GET_ITEM(sequence, 0);
__pyx_t_7 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_6);
__Pyx_INCREF(__pyx_t_7);
+ #else
+ __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- } else {
+ } else
+ {
Py_ssize_t index = -1;
- __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
@@ -17759,14 +18121,15 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
__Pyx_GOTREF(__pyx_t_6);
index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_7);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = NULL;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L7_unpacking_done;
__pyx_L6_unpacking_failed:;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
- if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_fname);
@@ -17776,40 +18139,40 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
__pyx_v_fval = __pyx_t_7;
__pyx_t_7 = 0;
- /* "_cdec.pyx":78
+ /* "_cdec.pyx":81
* self.weights.vector.clear()
* for fname, fval in weights.items():
* self.weights[fname] = fval # <<<<<<<<<<<<<<
* else:
* raise TypeError('cannot initialize weights with %s' % type(weights))
*/
- if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_v_fname, __pyx_v_fval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_v_fname, __pyx_v_fval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L3;
}
/*else*/ {
- /* "_cdec.pyx":80
+ /* "_cdec.pyx":83
* self.weights[fname] = fval
* else:
* raise TypeError('cannot initialize weights with %s' % type(weights)) # <<<<<<<<<<<<<<
*
* property formalism:
*/
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -17841,42 +18204,53 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_9formalism_1__get__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "_cdec.pyx":83
+/* "_cdec.pyx":86
*
* property formalism:
* def __get__(self): # <<<<<<<<<<<<<<
* cdef variables_map* conf = &self.dec.GetConf()
- * #return conf[0]['formalism']
+ * return conf[0]['formalism'].as_str().c_str()
*/
static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self) {
- CYTHON_UNUSED const boost::program_options::variables_map *__pyx_v_conf;
+ const boost::program_options::variables_map *__pyx_v_conf;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "_cdec.pyx":84
+ /* "_cdec.pyx":87
* property formalism:
* def __get__(self):
* cdef variables_map* conf = &self.dec.GetConf() # <<<<<<<<<<<<<<
- * #return conf[0]['formalism']
- * return None
+ * return conf[0]['formalism'].as_str().c_str()
+ *
*/
__pyx_v_conf = (&__pyx_v_self->dec->GetConf());
- /* "_cdec.pyx":86
+ /* "_cdec.pyx":88
+ * def __get__(self):
* cdef variables_map* conf = &self.dec.GetConf()
- * #return conf[0]['formalism']
- * return None # <<<<<<<<<<<<<<
+ * return conf[0]['formalism'].as_str().c_str() # <<<<<<<<<<<<<<
*
* def read_weights(self, weights):
*/
__Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(Py_None);
- __pyx_r = Py_None;
+ __pyx_t_1 = PyBytes_FromString(((__pyx_v_conf[0])[__pyx_k__formalism]).as<std::string>().c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_r = ((PyObject *)__pyx_t_1);
+ __pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_cdec.Decoder.formalism.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -17894,8 +18268,8 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "_cdec.pyx":88
- * return None
+/* "_cdec.pyx":90
+ * return conf[0]['formalism'].as_str().c_str()
*
* def read_weights(self, weights): # <<<<<<<<<<<<<<
* with open(weights) as fp:
@@ -17930,7 +18304,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("read_weights", 0);
- /* "_cdec.pyx":89
+ /* "_cdec.pyx":91
*
* def read_weights(self, weights):
* with open(weights) as fp: # <<<<<<<<<<<<<<
@@ -17938,19 +18312,19 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
* if line.strip().startswith('#'): continue
*/
/*with:*/ {
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_weights);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_weights);
__Pyx_GIVEREF(__pyx_v_weights);
- __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -17965,7 +18339,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__pyx_v_fp = __pyx_t_4;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "_cdec.pyx":90
+ /* "_cdec.pyx":92
* def read_weights(self, weights):
* with open(weights) as fp:
* for line in fp: # <<<<<<<<<<<<<<
@@ -17976,23 +18350,31 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__pyx_t_4 = __pyx_v_fp; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
__pyx_t_9 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_fp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_fp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
}
for (;;) {
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_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++;
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __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_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++;
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;};
+ #endif
} else {
__pyx_t_2 = __pyx_t_9(__pyx_t_4);
if (unlikely(!__pyx_t_2)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
break;
}
@@ -18002,25 +18384,25 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__pyx_v_line = __pyx_t_2;
__pyx_t_2 = 0;
- /* "_cdec.pyx":91
+ /* "_cdec.pyx":93
* with open(weights) as fp:
* for line in fp:
* if line.strip().startswith('#'): continue # <<<<<<<<<<<<<<
* fname, value = line.split()
* self.weights[fname.strip()] = float(value)
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_10) {
goto __pyx_L16_continue;
@@ -18028,43 +18410,49 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
}
__pyx_L18:;
- /* "_cdec.pyx":92
+ /* "_cdec.pyx":94
* for line in fp:
* if line.strip().startswith('#'): continue
* fname, value = line.split() # <<<<<<<<<<<<<<
* self.weights[fname.strip()] = float(value)
*
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
PyObject* sequence = __pyx_t_2;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ }
+ #if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
- if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- }
__pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
} else {
- if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
- if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
- else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- }
__pyx_t_1 = PyList_GET_ITEM(sequence, 0);
__pyx_t_11 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_1);
__Pyx_INCREF(__pyx_t_11);
+ #else
+ __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- } else {
+ } else
+ {
Py_ssize_t index = -1;
- __pyx_t_12 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
@@ -18072,14 +18460,15 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__Pyx_GOTREF(__pyx_t_1);
index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L19_unpacking_failed;
__Pyx_GOTREF(__pyx_t_11);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_13 = NULL;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
goto __pyx_L20_unpacking_done;
__pyx_L19_unpacking_failed:;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
- if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_13 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__pyx_L20_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_fname);
@@ -18089,22 +18478,22 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__pyx_v_value = __pyx_t_11;
__pyx_t_11 = 0;
- /* "_cdec.pyx":93
+ /* "_cdec.pyx":95
* if line.strip().startswith('#'): continue
* fname, value = line.split()
* self.weights[fname.strip()] = float(value) # <<<<<<<<<<<<<<
*
* def translate(self, sentence, grammar=None):
*/
- __pyx_t_14 = __Pyx_PyObject_AsDouble(__pyx_v_value); if (unlikely(__pyx_t_14 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_2 = PyFloat_FromDouble(__pyx_t_14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_14 = __Pyx_PyObject_AsDouble(__pyx_v_value); if (unlikely(__pyx_t_14 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = PyFloat_FromDouble(__pyx_t_14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_11 = PyObject_GetAttr(__pyx_v_fname, __pyx_n_s__strip); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_11 = PyObject_GetAttr(__pyx_v_fname, __pyx_n_s__strip); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_L16_continue:;
@@ -18122,7 +18511,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "_cdec.pyx":89
+ /* "_cdec.pyx":91
*
* def read_weights(self, weights):
* with open(weights) as fp: # <<<<<<<<<<<<<<
@@ -18131,11 +18520,11 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
*/
/*except:*/ {
__Pyx_AddTraceback("_cdec.Decoder.read_weights", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_2);
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_INCREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4);
@@ -18148,11 +18537,11 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_15 = PyObject_Call(__pyx_t_3, __pyx_t_11, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_15);
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__pyx_t_16 = (!__pyx_t_10);
if (__pyx_t_16) {
__Pyx_GIVEREF(__pyx_t_4);
@@ -18160,7 +18549,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_ErrRestore(__pyx_t_4, __pyx_t_2, __pyx_t_1);
__pyx_t_4 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
goto __pyx_L23;
}
__pyx_L23:;
@@ -18188,11 +18577,11 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
if (__pyx_t_3) {
__pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_52, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __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 (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
}
goto __pyx_L24;
@@ -18227,14 +18616,14 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO
static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_sentence = 0;
PyObject *__pyx_v_grammar = 0;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sentence,&__pyx_n_s__grammar,0};
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("translate (wrapper)", 0);
{
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sentence,&__pyx_n_s__grammar,0};
PyObject* values[2] = {0,0};
- /* "_cdec.pyx":95
+ /* "_cdec.pyx":97
* self.weights[fname.strip()] = float(value)
*
* def translate(self, sentence, grammar=None): # <<<<<<<<<<<<<<
@@ -18254,8 +18643,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sentence);
- if (likely(values[0])) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sentence)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
@@ -18264,7 +18652,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -18279,7 +18667,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("translate", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("translate", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_cdec.Decoder.translate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -18307,7 +18695,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("translate", 0);
- /* "_cdec.pyx":97
+ /* "_cdec.pyx":99
* def translate(self, sentence, grammar=None):
* cdef bytes input_str
* if isinstance(sentence, unicode) or isinstance(sentence, str): # <<<<<<<<<<<<<<
@@ -18329,19 +18717,19 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
}
if (__pyx_t_4) {
- /* "_cdec.pyx":98
+ /* "_cdec.pyx":100
* cdef bytes input_str
* if isinstance(sentence, unicode) or isinstance(sentence, str):
* input_str = as_str(sentence.strip()) # <<<<<<<<<<<<<<
* elif isinstance(sentence, Lattice):
* input_str = str(sentence) # PLF format
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyBytes_FromString(__pyx_f_5_cdec_as_str(__pyx_t_5, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(__pyx_f_5_cdec_as_str(__pyx_t_5, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_v_input_str = __pyx_t_1;
@@ -18349,7 +18737,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
goto __pyx_L3;
}
- /* "_cdec.pyx":99
+ /* "_cdec.pyx":101
* if isinstance(sentence, unicode) or isinstance(sentence, str):
* input_str = as_str(sentence.strip())
* elif isinstance(sentence, Lattice): # <<<<<<<<<<<<<<
@@ -18362,62 +18750,62 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_4) {
- /* "_cdec.pyx":100
+ /* "_cdec.pyx":102
* input_str = as_str(sentence.strip())
* elif isinstance(sentence, Lattice):
* input_str = str(sentence) # PLF format # <<<<<<<<<<<<<<
* else:
* raise TypeError('Cannot translate input type %s' % type(sentence))
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_sentence);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_sentence);
__Pyx_GIVEREF(__pyx_v_sentence);
- __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_input_str = ((PyObject*)__pyx_t_5);
__pyx_t_5 = 0;
goto __pyx_L3;
}
/*else*/ {
- /* "_cdec.pyx":102
+ /* "_cdec.pyx":104
* input_str = str(sentence) # PLF format
* else:
* raise TypeError('Cannot translate input type %s' % type(sentence)) # <<<<<<<<<<<<<<
* if grammar:
* if isinstance(grammar, str) or isinstance(grammar, unicode):
*/
- __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_Raise(__pyx_t_5, 0, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
- /* "_cdec.pyx":103
+ /* "_cdec.pyx":105
* else:
* raise TypeError('Cannot translate input type %s' % type(sentence))
* if grammar: # <<<<<<<<<<<<<<
* if isinstance(grammar, str) or isinstance(grammar, unicode):
* self.dec.AddSupplementalGrammarFromString(string(as_str(grammar)))
*/
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_grammar); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_grammar); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_4) {
- /* "_cdec.pyx":104
+ /* "_cdec.pyx":106
* raise TypeError('Cannot translate input type %s' % type(sentence))
* if grammar:
* if isinstance(grammar, str) or isinstance(grammar, unicode): # <<<<<<<<<<<<<<
@@ -18439,7 +18827,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
}
if (__pyx_t_3) {
- /* "_cdec.pyx":105
+ /* "_cdec.pyx":107
* if grammar:
* if isinstance(grammar, str) or isinstance(grammar, unicode):
* self.dec.AddSupplementalGrammarFromString(string(as_str(grammar))) # <<<<<<<<<<<<<<
@@ -18451,19 +18839,19 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
}
/*else*/ {
- /* "_cdec.pyx":107
+ /* "_cdec.pyx":109
* self.dec.AddSupplementalGrammarFromString(string(as_str(grammar)))
* else:
* self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0]) # <<<<<<<<<<<<<<
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
* self.dec.Decode(string(input_str), &observer)
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_grammar);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_grammar);
__Pyx_GIVEREF(__pyx_v_grammar);
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TextGrammar)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TextGrammar)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__pyx_v_self->dec->AddSupplementalGrammar((((struct __pyx_obj_5_cdec_TextGrammar *)__pyx_t_1)->__pyx_base.grammar[0]));
@@ -18474,7 +18862,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
}
__pyx_L4:;
- /* "_cdec.pyx":108
+ /* "_cdec.pyx":110
* else:
* self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0])
* cdef decoder.BasicObserver observer = decoder.BasicObserver() # <<<<<<<<<<<<<<
@@ -18483,17 +18871,17 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
*/
__pyx_v_observer = BasicObserver();
- /* "_cdec.pyx":109
+ /* "_cdec.pyx":111
* self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0])
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
* self.dec.Decode(string(input_str), &observer) # <<<<<<<<<<<<<<
* if observer.hypergraph == NULL:
* raise ParseFailed()
*/
- __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_input_str)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_input_str)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->dec->Decode(std::string(__pyx_t_6), (&__pyx_v_observer));
- /* "_cdec.pyx":110
+ /* "_cdec.pyx":112
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
* self.dec.Decode(string(input_str), &observer)
* if observer.hypergraph == NULL: # <<<<<<<<<<<<<<
@@ -18503,38 +18891,38 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
__pyx_t_3 = (__pyx_v_observer.hypergraph == NULL);
if (__pyx_t_3) {
- /* "_cdec.pyx":111
+ /* "_cdec.pyx":113
* self.dec.Decode(string(input_str), &observer)
* if observer.hypergraph == NULL:
* raise ParseFailed() # <<<<<<<<<<<<<<
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseFailed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseFailed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_Raise(__pyx_t_5, 0, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
__pyx_L6:;
- /* "_cdec.pyx":112
+ /* "_cdec.pyx":114
* if observer.hypergraph == NULL:
* raise ParseFailed()
* cdef Hypergraph hg = Hypergraph() # <<<<<<<<<<<<<<
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
* return hg
*/
- __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_v_hg = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_5);
__pyx_t_5 = 0;
- /* "_cdec.pyx":113
+ /* "_cdec.pyx":115
* raise ParseFailed()
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0]) # <<<<<<<<<<<<<<
@@ -18542,7 +18930,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
*/
__pyx_v_hg->hg = new Hypergraph((__pyx_v_observer.hypergraph[0]));
- /* "_cdec.pyx":114
+ /* "_cdec.pyx":116
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
* return hg # <<<<<<<<<<<<<<
@@ -18567,7 +18955,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
return __pyx_r;
}
-static PyObject *__pyx_tp_new_5_cdec_DenseVector(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_DenseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
return o;
@@ -18764,7 +19152,7 @@ static PyTypeObject __pyx_type_5_cdec_DenseVector = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_SparseVector(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_SparseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
return o;
@@ -18961,7 +19349,7 @@ static PyTypeObject __pyx_type_5_cdec_SparseVector = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_NT(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_NT(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec_NT *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -18994,11 +19382,11 @@ static int __pyx_tp_clear_5_cdec_NT(PyObject *o) {
return 0;
}
-static PyObject *__pyx_getprop_5_cdec_2NT_cat(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_2NT_cat(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_2NT_3cat_1__get__(o);
}
-static int __pyx_setprop_5_cdec_2NT_cat(PyObject *o, PyObject *v, void *x) {
+static int __pyx_setprop_5_cdec_2NT_cat(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5_cdec_2NT_3cat_3__set__(o, v);
}
@@ -19007,11 +19395,11 @@ static int __pyx_setprop_5_cdec_2NT_cat(PyObject *o, PyObject *v, void *x) {
}
}
-static PyObject *__pyx_getprop_5_cdec_2NT_ref(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_2NT_ref(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_2NT_3ref_1__get__(o);
}
-static int __pyx_setprop_5_cdec_2NT_ref(PyObject *o, PyObject *v, void *x) {
+static int __pyx_setprop_5_cdec_2NT_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5_cdec_2NT_3ref_3__set__(o, v);
}
@@ -19185,7 +19573,7 @@ static PyTypeObject __pyx_type_5_cdec_NT = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_NTRef(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_NTRef(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
return o;
@@ -19195,11 +19583,11 @@ static void __pyx_tp_dealloc_5_cdec_NTRef(PyObject *o) {
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_getprop_5_cdec_5NTRef_ref(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_5NTRef_ref(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_5NTRef_3ref_1__get__(o);
}
-static int __pyx_setprop_5_cdec_5NTRef_ref(PyObject *o, PyObject *v, void *x) {
+static int __pyx_setprop_5_cdec_5NTRef_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5_cdec_5NTRef_3ref_3__set__(o, v);
}
@@ -19372,7 +19760,7 @@ static PyTypeObject __pyx_type_5_cdec_NTRef = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_TRule(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_TRule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
return o;
@@ -19391,15 +19779,15 @@ static void __pyx_tp_dealloc_5_cdec_TRule(PyObject *o) {
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_getprop_5_cdec_5TRule_arity(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_5TRule_arity(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_5TRule_5arity_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_5TRule_f(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_5TRule_f(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_5TRule_1f_1__get__(o);
}
-static int __pyx_setprop_5_cdec_5TRule_f(PyObject *o, PyObject *v, void *x) {
+static int __pyx_setprop_5_cdec_5TRule_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5_cdec_5TRule_1f_3__set__(o, v);
}
@@ -19409,11 +19797,11 @@ static int __pyx_setprop_5_cdec_5TRule_f(PyObject *o, PyObject *v, void *x) {
}
}
-static PyObject *__pyx_getprop_5_cdec_5TRule_e(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_5TRule_e(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_5TRule_1e_1__get__(o);
}
-static int __pyx_setprop_5_cdec_5TRule_e(PyObject *o, PyObject *v, void *x) {
+static int __pyx_setprop_5_cdec_5TRule_e(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5_cdec_5TRule_1e_3__set__(o, v);
}
@@ -19423,11 +19811,11 @@ static int __pyx_setprop_5_cdec_5TRule_e(PyObject *o, PyObject *v, void *x) {
}
}
-static PyObject *__pyx_getprop_5_cdec_5TRule_a(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_5TRule_a(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_5TRule_1a_1__get__(o);
}
-static int __pyx_setprop_5_cdec_5TRule_a(PyObject *o, PyObject *v, void *x) {
+static int __pyx_setprop_5_cdec_5TRule_a(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5_cdec_5TRule_1a_4__set__(o, v);
}
@@ -19437,11 +19825,11 @@ static int __pyx_setprop_5_cdec_5TRule_a(PyObject *o, PyObject *v, void *x) {
}
}
-static PyObject *__pyx_getprop_5_cdec_5TRule_scores(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_5TRule_scores(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_5TRule_6scores_1__get__(o);
}
-static int __pyx_setprop_5_cdec_5TRule_scores(PyObject *o, PyObject *v, void *x) {
+static int __pyx_setprop_5_cdec_5TRule_scores(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5_cdec_5TRule_6scores_3__set__(o, v);
}
@@ -19451,11 +19839,11 @@ static int __pyx_setprop_5_cdec_5TRule_scores(PyObject *o, PyObject *v, void *x)
}
}
-static PyObject *__pyx_getprop_5_cdec_5TRule_lhs(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_5TRule_lhs(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_5TRule_3lhs_1__get__(o);
}
-static int __pyx_setprop_5_cdec_5TRule_lhs(PyObject *o, PyObject *v, void *x) {
+static int __pyx_setprop_5_cdec_5TRule_lhs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5_cdec_5TRule_3lhs_3__set__(o, v);
}
@@ -19761,7 +20149,11 @@ static PyTypeObject __pyx_type_5_cdec_MRule = {
&__pyx_tp_as_mapping_MRule, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
+ #if CYTHON_COMPILING_IN_PYPY
+ __pyx_pw_5_cdec_5TRule_5__str__, /*tp_str*/
+ #else
0, /*tp_str*/
+ #endif
0, /*tp_getattro*/
0, /*tp_setattro*/
&__pyx_tp_as_buffer_MRule, /*tp_as_buffer*/
@@ -19797,7 +20189,7 @@ static PyTypeObject __pyx_type_5_cdec_MRule = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_Grammar(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_Grammar(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
return o;
@@ -19816,11 +20208,11 @@ static void __pyx_tp_dealloc_5_cdec_Grammar(PyObject *o) {
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_getprop_5_cdec_7Grammar_name(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_7Grammar_name(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_7Grammar_4name_1__get__(o);
}
-static int __pyx_setprop_5_cdec_7Grammar_name(PyObject *o, PyObject *v, void *x) {
+static int __pyx_setprop_5_cdec_7Grammar_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5_cdec_7Grammar_4name_3__set__(o, v);
}
@@ -20134,7 +20526,11 @@ static PyTypeObject __pyx_type_5_cdec_TextGrammar = {
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
+ #if CYTHON_COMPILING_IN_PYPY
+ __pyx_pw_5_cdec_7Grammar_3__iter__, /*tp_iter*/
+ #else
0, /*tp_iter*/
+ #endif
0, /*tp_iternext*/
__pyx_methods_5_cdec_TextGrammar, /*tp_methods*/
0, /*tp_members*/
@@ -20159,10 +20555,14 @@ static PyTypeObject __pyx_type_5_cdec_TextGrammar = {
0, /*tp_version_tag*/
#endif
};
+static struct __pyx_vtabstruct_5_cdec_Hypergraph __pyx_vtable_5_cdec_Hypergraph;
-static PyObject *__pyx_tp_new_5_cdec_Hypergraph(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_Hypergraph(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_5_cdec_Hypergraph *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec_Hypergraph *)o);
+ p->__pyx_vtab = __pyx_vtabptr_5_cdec_Hypergraph;
return o;
}
@@ -20179,19 +20579,19 @@ static void __pyx_tp_dealloc_5_cdec_Hypergraph(PyObject *o) {
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_getprop_5_cdec_10Hypergraph_edges(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_10Hypergraph_edges(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_10Hypergraph_nodes(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_10Hypergraph_nodes(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_10Hypergraph_goal(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_10Hypergraph_goal(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_10Hypergraph_npaths(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_10Hypergraph_npaths(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_10Hypergraph_6npaths_1__get__(o);
}
@@ -20376,7 +20776,7 @@ static PyTypeObject __pyx_type_5_cdec_Hypergraph = {
};
static struct __pyx_vtabstruct_5_cdec_HypergraphEdge __pyx_vtable_5_cdec_HypergraphEdge;
-static PyObject *__pyx_tp_new_5_cdec_HypergraphEdge(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_HypergraphEdge(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec_HypergraphEdge *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -20410,31 +20810,31 @@ static int __pyx_tp_clear_5_cdec_HypergraphEdge(PyObject *o) {
return 0;
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_head_node(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_head_node(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_tail_nodes(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_tail_nodes(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_span(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_span(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_feature_values(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_feature_values(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_prob(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_prob(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_trule(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_trule(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(o);
}
-static int __pyx_setprop_5_cdec_14HypergraphEdge_trule(PyObject *o, PyObject *v, void *x) {
+static int __pyx_setprop_5_cdec_14HypergraphEdge_trule(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5_cdec_14HypergraphEdge_5trule_3__set__(o, v);
}
@@ -20612,7 +21012,7 @@ static PyTypeObject __pyx_type_5_cdec_HypergraphEdge = {
};
static struct __pyx_vtabstruct_5_cdec_HypergraphNode __pyx_vtable_5_cdec_HypergraphNode;
-static PyObject *__pyx_tp_new_5_cdec_HypergraphNode(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_HypergraphNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec_HypergraphNode *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -20625,19 +21025,19 @@ static void __pyx_tp_dealloc_5_cdec_HypergraphNode(PyObject *o) {
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_in_edges(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_in_edges(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_out_edges(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_out_edges(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_span(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_span(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_cat(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_cat(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(o);
}
@@ -21006,7 +21406,7 @@ static PyTypeObject __pyx_type_5_cdec_Lattice = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_Candidate(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_Candidate(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
return o;
@@ -21016,19 +21416,19 @@ static void __pyx_tp_dealloc_5_cdec_Candidate(PyObject *o) {
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_getprop_5_cdec_9Candidate_words(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_9Candidate_words(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_9Candidate_5words_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_9Candidate_fmap(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_9Candidate_fmap(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_9Candidate_4fmap_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_9Candidate_score(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_9Candidate_score(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_9Candidate_5score_1__get__(o);
}
-static int __pyx_setprop_5_cdec_9Candidate_score(PyObject *o, PyObject *v, void *x) {
+static int __pyx_setprop_5_cdec_9Candidate_score(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5_cdec_9Candidate_5score_3__set__(o, v);
}
@@ -21203,7 +21603,7 @@ static PyTypeObject __pyx_type_5_cdec_Candidate = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_SufficientStats(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_SufficientStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
return o;
@@ -21229,11 +21629,11 @@ static PyObject *__pyx_sq_item_5_cdec_SufficientStats(PyObject *o, Py_ssize_t i)
return r;
}
-static PyObject *__pyx_getprop_5_cdec_15SufficientStats_score(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_15SufficientStats_score(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_15SufficientStats_5score_1__get__(o);
}
-static PyObject *__pyx_getprop_5_cdec_15SufficientStats_detail(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_15SufficientStats_detail(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_15SufficientStats_6detail_1__get__(o);
}
@@ -21589,7 +21989,7 @@ static PyTypeObject __pyx_type_5_cdec_CandidateSet = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_SegmentEvaluator(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_SegmentEvaluator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
return o;
@@ -21948,7 +22348,7 @@ static PyTypeObject __pyx_type_5_cdec_Scorer = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec_Metric(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec_Metric(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec_Metric *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -22189,11 +22589,11 @@ static int __pyx_tp_clear_5_cdec_Decoder(PyObject *o) {
return 0;
}
-static PyObject *__pyx_getprop_5_cdec_7Decoder_weights(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_7Decoder_weights(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_7Decoder_7weights_1__get__(o);
}
-static int __pyx_setprop_5_cdec_7Decoder_weights(PyObject *o, PyObject *v, void *x) {
+static int __pyx_setprop_5_cdec_7Decoder_weights(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_5_cdec_7Decoder_7weights_3__set__(o, v);
}
@@ -22203,7 +22603,7 @@ static int __pyx_setprop_5_cdec_7Decoder_weights(PyObject *o, PyObject *v, void
}
}
-static PyObject *__pyx_getprop_5_cdec_7Decoder_formalism(PyObject *o, void *x) {
+static PyObject *__pyx_getprop_5_cdec_7Decoder_formalism(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_5_cdec_7Decoder_9formalism_1__get__(o);
}
@@ -22373,7 +22773,7 @@ static PyTypeObject __pyx_type_5_cdec_Decoder = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -22564,7 +22964,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct____iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -22755,7 +23155,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_1___iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -22946,7 +23346,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_2__phrase = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -23153,7 +23553,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_genexpr = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -23344,7 +23744,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_4___get__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -23535,7 +23935,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_5___str__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -23742,7 +24142,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_6_genexpr = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -23941,7 +24341,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7___iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -24140,7 +24540,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_8_kbest = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -24355,7 +24755,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -24562,7 +24962,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_10_kbest_features = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_11_sample(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_11_sample(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -24753,7 +25153,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_11_sample = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -24944,7 +25344,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12_sample_trees = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_13___get__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_13___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -25135,7 +25535,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_13___get__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_14___get__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_14___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -25326,7 +25726,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_14___get__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_15___get__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_15___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -25517,7 +25917,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_15___get__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -25708,7 +26108,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_16___get__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -25899,7 +26299,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___get__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -26090,7 +26490,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18___iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_19_todot(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_19_todot(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -26281,7 +26681,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_todot = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_20_lines(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_20_lines(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -26520,7 +26920,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20_lines = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -26727,7 +27127,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -26918,7 +27318,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_22___iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_23__make_config(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_23__make_config(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -27157,7 +27557,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_23__make_config = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_24___cinit__(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_24___cinit__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -27348,7 +27748,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_24___cinit__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_25_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_25_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -27689,6 +28089,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__scores, __pyx_k__scores, sizeof(__pyx_k__scores), 0, 0, 1, 1},
{&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
{&__pyx_n_s__sentence, __pyx_k__sentence, sizeof(__pyx_k__sentence), 0, 0, 1, 1},
+ {&__pyx_n_s__set_silent, __pyx_k__set_silent, sizeof(__pyx_k__set_silent), 0, 0, 1, 1},
{&__pyx_n_s__span, __pyx_k__span, sizeof(__pyx_k__span), 0, 0, 1, 1},
{&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
{&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1},
@@ -27698,6 +28099,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__utf8, __pyx_k__utf8, sizeof(__pyx_k__utf8), 0, 0, 1, 1},
{&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1},
{&__pyx_n_s__weight, __pyx_k__weight, sizeof(__pyx_k__weight), 0, 0, 1, 1},
+ {&__pyx_n_s__yn, __pyx_k__yn, sizeof(__pyx_k__yn), 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
@@ -27708,10 +28110,10 @@ static int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_NotImplemented = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_super = __Pyx_GetName(__pyx_b, __pyx_n_s__super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_eval = __Pyx_GetName(__pyx_b, __pyx_n_s__eval); if (!__pyx_builtin_eval) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_eval = __Pyx_GetName(__pyx_b, __pyx_n_s__eval); if (!__pyx_builtin_eval) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
@@ -27735,7 +28137,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
- /* "/home/cdyer/cdec/python/src/vectors.pxi":89
+ /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":89
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<<
@@ -27749,7 +28151,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
- /* "/home/cdyer/cdec/python/src/grammar.pxi":6
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
@@ -27763,7 +28165,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
- /* "/home/cdyer/cdec/python/src/grammar.pxi":212
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":212
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<<
@@ -27776,33 +28178,33 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":203
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":204
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<<
*
* cdef class HypergraphNode:
*/
- __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_18);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_17));
PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_s_17));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
- /* "/home/cdyer/cdec/python/src/hypergraph.pxi":240
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":241
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<<
*/
- __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_20);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_19));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
- /* "/home/cdyer/cdec/python/src/lattice.pxi":13
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":13
* else:
* if isinstance(inp, unicode):
* inp = inp.encode('utf8') # <<<<<<<<<<<<<<
@@ -27816,7 +28218,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
- /* "/home/cdyer/cdec/python/src/lattice.pxi":24
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":24
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
@@ -27830,7 +28232,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
- /* "/home/cdyer/cdec/python/src/lattice.pxi":37
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":37
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
@@ -27844,7 +28246,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
- /* "/home/cdyer/cdec/python/src/lattice.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":41
* for (label, cost, dist2next) in arcs:
* if isinstance(label, unicode):
* label = label.encode('utf8') # <<<<<<<<<<<<<<
@@ -27858,7 +28260,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
- /* "/home/cdyer/cdec/python/src/lattice.pxi":64
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":64
* for i in range(len(self)):
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) # <<<<<<<<<<<<<<
@@ -27875,7 +28277,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
- /* "/home/cdyer/cdec/python/src/lattice.pxi":58
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
*
* def todot(self):
* def lines(): # <<<<<<<<<<<<<<
@@ -27899,7 +28301,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
__pyx_k_codeobj_37 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_38, __pyx_n_s__lines, 58, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_37)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/lattice.pxi":67
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":67
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
* return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<<
@@ -27911,7 +28313,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
- /* "/home/cdyer/cdec/python/src/mteval.pxi":50
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":50
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<<
@@ -27925,7 +28327,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
- /* "/home/cdyer/cdec/python/src/mteval.pxi":84
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":84
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<<
@@ -27939,14 +28341,14 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
- /* "_cdec.pyx":50
+ /* "_cdec.pyx":53
* """
* if config_str is None:
* formalism = config.get('formalism', None) # <<<<<<<<<<<<<<
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb',
* 'csplit', 'tagger', 'lexalign'):
*/
- __pyx_k_tuple_47 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_47 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_47);
__Pyx_INCREF(((PyObject *)__pyx_n_s__formalism));
PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_n_s__formalism));
@@ -27956,28 +28358,28 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(Py_None);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
- /* "_cdec.pyx":91
+ /* "_cdec.pyx":93
* with open(weights) as fp:
* for line in fp:
* if line.strip().startswith('#'): continue # <<<<<<<<<<<<<<
* fname, value = line.split()
* self.weights[fname.strip()] = float(value)
*/
- __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_51);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_50));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
- /* "_cdec.pyx":89
+ /* "_cdec.pyx":91
*
* def read_weights(self, weights):
* with open(weights) as fp: # <<<<<<<<<<<<<<
* for line in fp:
* if line.strip().startswith('#'): continue
*/
- __pyx_k_tuple_52 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_52 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_52);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, Py_None);
@@ -27990,7 +28392,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(Py_None);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
- /* "/home/cdyer/cdec/python/src/grammar.pxi":5
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
@@ -28011,7 +28413,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
__pyx_k_codeobj_57 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_58, __pyx_n_s___phrase, 5, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_57)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/home/cdyer/cdec/python/src/mteval.pxi":190
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":190
* return []
*
* BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<<
@@ -28025,7 +28427,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__IBM_BLEU));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
- /* "/home/cdyer/cdec/python/src/mteval.pxi":191
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":191
*
* BLEU = Scorer('IBM_BLEU')
* TER = Scorer('TER') # <<<<<<<<<<<<<<
@@ -28038,7 +28440,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__TER));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
- /* "/home/cdyer/cdec/python/src/mteval.pxi":192
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":192
* BLEU = Scorer('IBM_BLEU')
* TER = Scorer('TER')
* CER = Scorer('CER') # <<<<<<<<<<<<<<
@@ -28053,29 +28455,44 @@ static int __Pyx_InitCachedConstants(void) {
/* "_cdec.pyx":28
* class ParseFailed(Exception): pass
*
+ * def set_silent(yn): # <<<<<<<<<<<<<<
+ * SetSilent(yn)
+ *
+ */
+ __pyx_k_tuple_62 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_62);
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__yn));
+ PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, ((PyObject *)__pyx_n_s__yn));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__yn));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));
+ __pyx_k_codeobj_63 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_64, __pyx_n_s__set_silent, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "_cdec.pyx":31
+ * SetSilent(yn)
+ *
* def _make_config(config): # <<<<<<<<<<<<<<
* for key, value in config.items():
* if isinstance(value, dict):
*/
- __pyx_k_tuple_62 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_62);
+ __pyx_k_tuple_65 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_65);
__Pyx_INCREF(((PyObject *)__pyx_n_s__config));
- PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, ((PyObject *)__pyx_n_s__config));
+ PyTuple_SET_ITEM(__pyx_k_tuple_65, 0, ((PyObject *)__pyx_n_s__config));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__config));
__Pyx_INCREF(((PyObject *)__pyx_n_s__key));
- PyTuple_SET_ITEM(__pyx_k_tuple_62, 1, ((PyObject *)__pyx_n_s__key));
+ PyTuple_SET_ITEM(__pyx_k_tuple_65, 1, ((PyObject *)__pyx_n_s__key));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
__Pyx_INCREF(((PyObject *)__pyx_n_s__value));
- PyTuple_SET_ITEM(__pyx_k_tuple_62, 2, ((PyObject *)__pyx_n_s__value));
+ PyTuple_SET_ITEM(__pyx_k_tuple_65, 2, ((PyObject *)__pyx_n_s__value));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__value));
__Pyx_INCREF(((PyObject *)__pyx_n_s__name));
- PyTuple_SET_ITEM(__pyx_k_tuple_62, 3, ((PyObject *)__pyx_n_s__name));
+ PyTuple_SET_ITEM(__pyx_k_tuple_65, 3, ((PyObject *)__pyx_n_s__name));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__name));
__Pyx_INCREF(((PyObject *)__pyx_n_s__info));
- PyTuple_SET_ITEM(__pyx_k_tuple_62, 4, ((PyObject *)__pyx_n_s__info));
+ PyTuple_SET_ITEM(__pyx_k_tuple_65, 4, ((PyObject *)__pyx_n_s__info));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__info));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));
- __pyx_k_codeobj_63 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_64, __pyx_n_s___make_config, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65));
+ __pyx_k_codeobj_66 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_64, __pyx_n_s___make_config, 31, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
@@ -28147,6 +28564,9 @@ PyMODINIT_FUNC PyInit__cdec(void)
#endif
__pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ #if CYTHON_COMPILING_IN_PYPY
+ Py_INCREF(__pyx_b);
+ #endif
if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
/*--- Initialize various global constants etc. ---*/
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -28187,20 +28607,23 @@ PyMODINIT_FUNC PyInit__cdec(void)
if (PyType_Ready(&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "TextGrammar", (PyObject *)&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_TextGrammar = &__pyx_type_5_cdec_TextGrammar;
+ __pyx_vtabptr_5_cdec_Hypergraph = &__pyx_vtable_5_cdec_Hypergraph;
+ __pyx_vtable_5_cdec_Hypergraph._rng = (MT19937 *(*)(struct __pyx_obj_5_cdec_Hypergraph *))__pyx_f_5_cdec_10Hypergraph__rng;
if (PyType_Ready(&__pyx_type_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetVtable(__pyx_type_5_cdec_Hypergraph.tp_dict, __pyx_vtabptr_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "Hypergraph", (PyObject *)&__pyx_type_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_Hypergraph = &__pyx_type_5_cdec_Hypergraph;
__pyx_vtabptr_5_cdec_HypergraphEdge = &__pyx_vtable_5_cdec_HypergraphEdge;
__pyx_vtable_5_cdec_HypergraphEdge.init = (PyObject *(*)(struct __pyx_obj_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int))__pyx_f_5_cdec_14HypergraphEdge_init;
- if (PyType_Ready(&__pyx_type_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetVtable(__pyx_type_5_cdec_HypergraphEdge.tp_dict, __pyx_vtabptr_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "HypergraphEdge", (PyObject *)&__pyx_type_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetVtable(__pyx_type_5_cdec_HypergraphEdge.tp_dict, __pyx_vtabptr_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "HypergraphEdge", (PyObject *)&__pyx_type_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_HypergraphEdge = &__pyx_type_5_cdec_HypergraphEdge;
__pyx_vtabptr_5_cdec_HypergraphNode = &__pyx_vtable_5_cdec_HypergraphNode;
__pyx_vtable_5_cdec_HypergraphNode.init = (PyObject *(*)(struct __pyx_obj_5_cdec_HypergraphNode *, Hypergraph *, unsigned int))__pyx_f_5_cdec_14HypergraphNode_init;
- if (PyType_Ready(&__pyx_type_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetVtable(__pyx_type_5_cdec_HypergraphNode.tp_dict, __pyx_vtabptr_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "HypergraphNode", (PyObject *)&__pyx_type_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetVtable(__pyx_type_5_cdec_HypergraphNode.tp_dict, __pyx_vtabptr_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "HypergraphNode", (PyObject *)&__pyx_type_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_HypergraphNode = &__pyx_type_5_cdec_HypergraphNode;
if (PyType_Ready(&__pyx_type_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "Lattice", (PyObject *)&__pyx_type_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -28223,8 +28646,8 @@ PyMODINIT_FUNC PyInit__cdec(void)
if (PyType_Ready(&__pyx_type_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "Metric", (PyObject *)&__pyx_type_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_Metric = &__pyx_type_5_cdec_Metric;
- if (PyType_Ready(&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Decoder", (PyObject *)&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "Decoder", (PyObject *)&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_Decoder = &__pyx_type_5_cdec_Decoder;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct____iter__ = &__pyx_type_5_cdec___pyx_scope_struct____iter__;
@@ -28242,25 +28665,25 @@ PyMODINIT_FUNC PyInit__cdec(void)
__pyx_ptype_5_cdec___pyx_scope_struct_6_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_6_genexpr;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_7___iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_7___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_7___iter__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_8_kbest) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_8_kbest) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_8_kbest = &__pyx_type_5_cdec___pyx_scope_struct_8_kbest;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_9_kbest_trees = &__pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_10_kbest_features) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_10_kbest_features) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_10_kbest_features = &__pyx_type_5_cdec___pyx_scope_struct_10_kbest_features;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_11_sample) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_11_sample) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_11_sample = &__pyx_type_5_cdec___pyx_scope_struct_11_sample;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_12_sample_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_12_sample_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees = &__pyx_type_5_cdec___pyx_scope_struct_12_sample_trees;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_13___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_13___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_13___get__ = &__pyx_type_5_cdec___pyx_scope_struct_13___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_14___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_14___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_14___get__ = &__pyx_type_5_cdec___pyx_scope_struct_14___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_15___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_15___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_15___get__ = &__pyx_type_5_cdec___pyx_scope_struct_15___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_16___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_16___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_16___get__ = &__pyx_type_5_cdec___pyx_scope_struct_16___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_17___get__ = &__pyx_type_5_cdec___pyx_scope_struct_17___get__;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_18___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_18___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_18___iter__;
@@ -28272,11 +28695,11 @@ PyMODINIT_FUNC PyInit__cdec(void)
__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_21___iter__;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_22___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_22___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_22___iter__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_23__make_config) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_23__make_config) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_23__make_config = &__pyx_type_5_cdec___pyx_scope_struct_23__make_config;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_24___cinit__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_24___cinit__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_24___cinit__ = &__pyx_type_5_cdec___pyx_scope_struct_24___cinit__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_25_genexpr;
/*--- Type import code ---*/
__pyx_ptype_4cdec_2sa_3_sa_Phrase = __Pyx_ImportType("cdec.sa._sa", "Phrase", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Phrase), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -28292,7 +28715,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*--- Execution code ---*/
- /* "/home/cdyer/cdec/python/src/grammar.pxi":3
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":3
* cimport grammar
* cimport cdec.sa._sa as _sa
* import cdec.sa._sa as _sa # <<<<<<<<<<<<<<
@@ -28310,7 +28733,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
if (PyObject_SetAttr(__pyx_m, __pyx_n_s___sa, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/cdyer/cdec/python/src/grammar.pxi":5
+ /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
@@ -28322,7 +28745,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
if (PyObject_SetAttr(__pyx_m, __pyx_n_s___phrase, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":190
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":190
* return []
*
* BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<<
@@ -28334,7 +28757,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BLEU, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":191
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":191
*
* BLEU = Scorer('IBM_BLEU')
* TER = Scorer('TER') # <<<<<<<<<<<<<<
@@ -28345,7 +28768,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/cdyer/cdec/python/src/mteval.pxi":192
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":192
* BLEU = Scorer('IBM_BLEU')
* TER = Scorer('TER')
* CER = Scorer('CER') # <<<<<<<<<<<<<<
@@ -28399,7 +28822,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
* class InvalidConfig(Exception): pass
* class ParseFailed(Exception): pass # <<<<<<<<<<<<<<
*
- * def _make_config(config):
+ * def set_silent(yn):
*/
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
@@ -28418,13 +28841,25 @@ PyMODINIT_FUNC PyInit__cdec(void)
/* "_cdec.pyx":28
* class ParseFailed(Exception): pass
*
+ * def set_silent(yn): # <<<<<<<<<<<<<<
+ * SetSilent(yn)
+ *
+ */
+ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_3set_silent, NULL, __pyx_n_s___cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_silent, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "_cdec.pyx":31
+ * SetSilent(yn)
+ *
* def _make_config(config): # <<<<<<<<<<<<<<
* for key, value in config.items():
* if isinstance(value, dict):
*/
- __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_3_make_config, NULL, __pyx_n_s___cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_5_make_config, NULL, __pyx_n_s___cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s___make_config, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s___make_config, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "_cdec.pyx":1
@@ -28662,7 +29097,7 @@ static void __Pyx_RaiseArgtupleInvalid(
more_or_less = "exactly";
}
PyErr_Format(PyExc_TypeError,
- "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
+ "%s() takes %s %" PY_FORMAT_SIZE_T "d positional argument%s (%" PY_FORMAT_SIZE_T "d given)",
func_name, more_or_less, num_expected,
(num_expected == 1) ? "" : "s", num_found);
}
@@ -28674,6 +29109,11 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
{
PyObject* key = 0;
Py_ssize_t pos = 0;
+#if CPYTHON_COMPILING_IN_PYPY
+ if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
+ goto invalid_keyword;
+ return 1;
+#else
while (PyDict_Next(kwdict, &pos, &key, 0)) {
#if PY_MAJOR_VERSION < 3
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
@@ -28689,6 +29129,7 @@ invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
"%s() keywords must be strings", function_name);
return 0;
+#endif
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
@@ -28827,17 +29268,49 @@ bad:
return -1;
}
-
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
+ PyErr_Format(PyExc_ValueError,
+ "too many values to unpack (expected %" PY_FORMAT_SIZE_T "d)", expected);
+}
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
- "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
+ "need more than %" PY_FORMAT_SIZE_T "d value%s to unpack",
index, (index == 1) ? "" : "s");
}
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
- PyErr_Format(PyExc_ValueError,
- "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
+static CYTHON_INLINE int __Pyx_IterFinish(void) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* exc_type = tstate->curexc_type;
+ if (unlikely(exc_type)) {
+ if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
+ PyObject *exc_value, *exc_tb;
+ exc_value = tstate->curexc_value;
+ exc_tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+ Py_DECREF(exc_type);
+ Py_XDECREF(exc_value);
+ Py_XDECREF(exc_tb);
+ return 0;
+ } else {
+ return -1;
+ }
+ }
+ return 0;
+#else
+ if (unlikely(PyErr_Occurred())) {
+ if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
+ PyErr_Clear();
+ return 0;
+ } else {
+ return -1;
+ }
+ }
+ return 0;
+#endif
}
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
@@ -28845,45 +29318,54 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
Py_DECREF(retval);
__Pyx_RaiseTooManyValuesError(expected);
return -1;
- } else if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
- PyErr_Clear();
- return 0;
- } else {
- return -1;
- }
+ } else {
+ return __Pyx_IterFinish();
}
return 0;
}
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
PyObject* next;
- if (unlikely(!PyIter_Check(iterator))) {
+ iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (unlikely(!iternext)) {
+#else
+ if (unlikely(!iternext) || unlikely(!PyIter_Check(iterator))) {
+#endif
PyErr_Format(PyExc_TypeError,
- "%.200s object is not an iterator", iterator->ob_type->tp_name);
+ "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name);
return NULL;
}
- next = (*(Py_TYPE(iterator)->tp_iternext))(iterator);
- if (likely(next)) {
+ next = iternext(iterator);
+ if (likely(next))
return next;
- } else if (defval) {
- if (PyErr_Occurred()) {
- if(!PyErr_ExceptionMatches(PyExc_StopIteration))
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_VERSION_HEX >= 0x03010000 || (PY_MAJOR_VERSION < 3 && PY_VERSION_HEX >= 0x02070000)
+ if (unlikely(iternext == &_PyObject_NextNotImplemented))
+ return NULL;
+#endif
+#endif
+ if (defval) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (unlikely(exc_type != PyExc_StopIteration) &&
+ !PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))
return NULL;
PyErr_Clear();
}
Py_INCREF(defval);
return defval;
- } else if (PyErr_Occurred()) {
- return NULL;
- } else {
- PyErr_SetNone(PyExc_StopIteration);
- return NULL;
}
+ if (!PyErr_Occurred())
+ PyErr_SetNone(PyExc_StopIteration);
+ return NULL;
}
static double __Pyx__PyObject_AsDouble(PyObject* obj) {
PyObject* float_value;
+#if CYTHON_COMPILING_IN_PYPY
+ float_value = PyNumber_Float(obj);
+#else
if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) {
return PyFloat_AsDouble(obj);
} else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
@@ -28900,6 +29382,7 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) {
PyTuple_SET_ITEM(args, 0, 0);
Py_DECREF(args);
}
+#endif
if (likely(float_value)) {
double value = PyFloat_AS_DOUBLE(float_value);
Py_DECREF(float_value);
@@ -28911,6 +29394,7 @@ bad:
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
PyObject *local_type, *local_value, *local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
local_type = tstate->curexc_type;
@@ -28919,19 +29403,27 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(&local_type, &local_value, &local_tb);
+#endif
PyErr_NormalizeException(&local_type, &local_value, &local_tb);
+#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(tstate->curexc_type))
+#else
+ if (unlikely(PyErr_Occurred()))
+#endif
goto bad;
#if PY_MAJOR_VERSION >= 3
if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
goto bad;
#endif
- *type = local_type;
- *value = local_value;
- *tb = local_tb;
Py_INCREF(local_type);
Py_INCREF(local_value);
Py_INCREF(local_tb);
+ *type = local_type;
+ *value = local_value;
+ *tb = local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
tmp_type = tstate->exc_type;
tmp_value = tstate->exc_value;
tmp_tb = tstate->exc_traceback;
@@ -28939,10 +29431,13 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
tstate->exc_value = local_value;
tstate->exc_traceback = local_tb;
/* Make sure tstate is in a consistent state when we XDECREF
- these objects (XDECREF may run arbitrary code). */
+ these objects (DECREF may run arbitrary code). */
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(local_type, local_value, local_tb);
+#endif
return 0;
bad:
*type = 0;
@@ -28955,6 +29450,7 @@ bad:
}
static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
PyThreadState *tstate = PyThreadState_GET();
*type = tstate->exc_type;
*value = tstate->exc_value;
@@ -28962,8 +29458,12 @@ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value,
Py_XINCREF(*type);
Py_XINCREF(*value);
Py_XINCREF(*tb);
+#else
+ PyErr_GetExcInfo(type, value, tb);
+#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
tmp_type = tstate->exc_type;
@@ -28975,6 +29475,9 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb)
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(type, value, tb);
+#endif
}
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
@@ -29048,7 +29551,6 @@ bad:
static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
PyObject *metaclass;
- /* Default metaclass */
#if PY_MAJOR_VERSION < 3
if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
PyObject *base = PyTuple_GET_ITEM(bases, 0);
@@ -29078,7 +29580,6 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na
PyObject *metaclass;
if (PyDict_SetItemString(dict, "__module__", modname) < 0)
return NULL;
- /* Python2 __metaclass__ */
metaclass = PyDict_GetItemString(dict, "__metaclass__");
if (metaclass) {
Py_INCREF(metaclass);
@@ -29460,6 +29961,56 @@ __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
PyString_AsString(func_name), (void *)op);
#endif
}
+#if CYTHON_COMPILING_IN_PYPY
+static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+ PyCFunctionObject* f = (PyCFunctionObject*)func;
+ PyCFunction meth = PyCFunction_GET_FUNCTION(func);
+ PyObject *self = PyCFunction_GET_SELF(func);
+ Py_ssize_t size;
+ switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
+ case METH_VARARGS:
+ if (likely(kw == NULL) || PyDict_Size(kw) == 0)
+ return (*meth)(self, arg);
+ break;
+ case METH_VARARGS | METH_KEYWORDS:
+ return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
+ case METH_NOARGS:
+ if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
+ size = PyTuple_GET_SIZE(arg);
+ if (size == 0)
+ return (*meth)(self, NULL);
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() takes no arguments (%zd given)",
+ f->m_ml->ml_name, size);
+ return NULL;
+ }
+ break;
+ case METH_O:
+ if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
+ size = PyTuple_GET_SIZE(arg);
+ if (size == 1)
+ return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() takes exactly one argument (%zd given)",
+ f->m_ml->ml_name, size);
+ return NULL;
+ }
+ break;
+ default:
+ PyErr_SetString(PyExc_SystemError, "Bad call flags in "
+ "__Pyx_CyFunction_Call. METH_OLDARGS is no "
+ "longer supported!");
+ return NULL;
+ }
+ PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
+ f->m_ml->ml_name);
+ return NULL;
+}
+#else
+static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+ return PyCFunction_Call(func, arg, kw);
+}
+#endif
static PyTypeObject __pyx_CyFunctionType_type = {
PyVarObject_HEAD_INIT(0, 0)
__Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
@@ -29479,7 +30030,7 @@ static PyTypeObject __pyx_CyFunctionType_type = {
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
- __Pyx_PyCFunction_Call, /*tp_call*/
+ __Pyx_CyFunction_Call, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
@@ -29515,15 +30066,16 @@ static PyTypeObject __pyx_CyFunctionType_type = {
0, /*tp_version_tag*/
#endif
};
-static int __Pyx_CyFunction_init(void)
-{
+static int __Pyx_CyFunction_init(void) {
+#if !CYTHON_COMPILING_IN_PYPY
+ __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
+#endif
if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
return -1;
__pyx_CyFunctionType = &__pyx_CyFunctionType_type;
return 0;
}
-void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects)
-{
+static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->defaults = PyMem_Malloc(size);
if (!m->defaults)
@@ -29532,14 +30084,16 @@ void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects)
m->defaults_pyobjects = pyobjects;
return m->defaults;
}
-static void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple)
-{
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->defaults_tuple = tuple;
Py_INCREF(tuple);
}
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
+#if CYTHON_COMPILING_IN_PYPY
+ return PyObject_RichCompareBool(s1, s2, equals);
+#else
if (s1 == s2) {
return (equals == Py_EQ);
} else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
@@ -29567,9 +30121,13 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq
Py_DECREF(py_result);
return result;
}
+#endif
}
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
+#if CYTHON_COMPILING_IN_PYPY
+ return PyObject_RichCompareBool(s1, s2, equals);
+#else
if (s1 == s2) {
return (equals == Py_EQ);
} else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
@@ -29609,6 +30167,7 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int
Py_DECREF(py_result);
return result;
}
+#endif
}
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
@@ -30011,8 +30570,8 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
}
}
-static void __Pyx_WriteUnraisable(const char *name, int clineno,
- int lineno, const char *filename) {
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+ CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
PyObject *old_exc, *old_val, *old_tb;
PyObject *ctx;
__Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
@@ -30032,6 +30591,7 @@ static void __Pyx_WriteUnraisable(const char *name, int clineno,
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
PyThreadState *tstate = PyThreadState_GET();
tmp_type = tstate->exc_type;
tmp_value = tstate->exc_value;
@@ -30039,6 +30599,10 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value,
tstate->exc_type = *type;
tstate->exc_value = *value;
tstate->exc_traceback = *tb;
+#else
+ PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
+ PyErr_SetExcInfo(*type, *value, *tb);
+#endif
*type = tmp_type;
*value = tmp_value;
*tb = tmp_tb;
@@ -30048,9 +30612,70 @@ static PyObject *__Pyx_Generator_Next(PyObject *self);
static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Generator_Close(PyObject *self);
static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args);
+static PyTypeObject *__pyx_GeneratorType = 0;
+#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
+#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
+#if 1 || PY_VERSION_HEX < 0x030300B0
+static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
+ PyObject *et, *ev, *tb;
+ PyObject *value = NULL;
+ __Pyx_ErrFetch(&et, &ev, &tb);
+ if (!et) {
+ Py_XDECREF(tb);
+ Py_XDECREF(ev);
+ Py_INCREF(Py_None);
+ *pvalue = Py_None;
+ return 0;
+ }
+ if (unlikely(et != PyExc_StopIteration) &&
+ unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) {
+ __Pyx_ErrRestore(et, ev, tb);
+ return -1;
+ }
+ if (likely(et == PyExc_StopIteration)) {
+ if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) {
+ if (!ev) {
+ Py_INCREF(Py_None);
+ ev = Py_None;
+ }
+ Py_XDECREF(tb);
+ Py_DECREF(et);
+ *pvalue = ev;
+ return 0;
+ }
+ }
+ PyErr_NormalizeException(&et, &ev, &tb);
+ if (unlikely(!PyObject_IsInstance(ev, PyExc_StopIteration))) {
+ __Pyx_ErrRestore(et, ev, tb);
+ return -1;
+ }
+ Py_XDECREF(tb);
+ Py_DECREF(et);
+#if PY_VERSION_HEX >= 0x030300A0
+ value = ((PyStopIterationObject *)ev)->value;
+ Py_INCREF(value);
+ Py_DECREF(ev);
+#else
+ {
+ PyObject* args = PyObject_GetAttrString(ev, "args");
+ Py_DECREF(ev);
+ if (likely(args)) {
+ value = PyObject_GetItem(args, 0);
+ Py_DECREF(args);
+ }
+ if (unlikely(!value)) {
+ __Pyx_ErrRestore(NULL, NULL, NULL);
+ Py_INCREF(Py_None);
+ value = Py_None;
+ }
+ }
+#endif
+ *pvalue = value;
+ return 0;
+}
+#endif
static CYTHON_INLINE
-void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self)
-{
+void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) {
PyObject *exc_type = self->exc_type;
PyObject *exc_value = self->exc_value;
PyObject *exc_traceback = self->exc_traceback;
@@ -30062,14 +30687,18 @@ void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self)
Py_XDECREF(exc_traceback);
}
static CYTHON_INLINE
-PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value)
-{
- PyObject *retval;
- if (unlikely(self->is_running)) {
+int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) {
+ if (unlikely(gen->is_running)) {
PyErr_SetString(PyExc_ValueError,
"generator already executing");
- return NULL;
+ return 1;
}
+ return 0;
+}
+static CYTHON_INLINE
+PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
+ PyObject *retval;
+ assert(!self->is_running);
if (unlikely(self->resume_label == 0)) {
if (unlikely(value && value != Py_None)) {
PyErr_SetString(PyExc_TypeError,
@@ -30082,81 +30711,240 @@ PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value)
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
- if (value)
- __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback);
- else
+ if (value) {
+#if CYTHON_COMPILING_IN_PYPY
+#else
+ /* Generators always return to their most recent caller, not
+ * necessarily their creator. */
+ if (self->exc_traceback) {
+ PyThreadState *tstate = PyThreadState_GET();
+ PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
+ PyFrameObject *f = tb->tb_frame;
+ Py_XINCREF(tstate->frame);
+ assert(f->f_back == NULL);
+ f->f_back = tstate->frame;
+ }
+#endif
+ __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
+ &self->exc_traceback);
+ } else {
__Pyx_Generator_ExceptionClear(self);
+ }
self->is_running = 1;
retval = self->body((PyObject *) self, value);
self->is_running = 0;
- if (retval)
- __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback);
- else
+ if (retval) {
+ __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
+ &self->exc_traceback);
+#if CYTHON_COMPILING_IN_PYPY
+#else
+ /* Don't keep the reference to f_back any longer than necessary. It
+ * may keep a chain of frames alive or it could create a reference
+ * cycle. */
+ if (self->exc_traceback) {
+ PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
+ PyFrameObject *f = tb->tb_frame;
+ Py_CLEAR(f->f_back);
+ }
+#endif
+ } else {
__Pyx_Generator_ExceptionClear(self);
+ }
return retval;
}
-static PyObject *__Pyx_Generator_Next(PyObject *self)
-{
- return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, Py_None);
+static CYTHON_INLINE
+PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) {
+ PyObject *ret;
+ PyObject *val = NULL;
+ __Pyx_Generator_Undelegate(gen);
+ __Pyx_PyGen_FetchStopIterationValue(&val);
+ ret = __Pyx_Generator_SendEx(gen, val);
+ Py_XDECREF(val);
+ return ret;
+}
+static PyObject *__Pyx_Generator_Next(PyObject *self) {
+ __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
+ PyObject *yf = gen->yieldfrom;
+ if (unlikely(__Pyx_Generator_CheckRunning(gen)))
+ return NULL;
+ if (yf) {
+ PyObject *ret;
+ gen->is_running = 1;
+ ret = Py_TYPE(yf)->tp_iternext(yf);
+ gen->is_running = 0;
+ if (likely(ret)) {
+ return ret;
+ }
+ return __Pyx_Generator_FinishDelegation(gen);
+ }
+ return __Pyx_Generator_SendEx(gen, Py_None);
}
-static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value)
-{
- return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, value);
+static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) {
+ __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
+ PyObject *yf = gen->yieldfrom;
+ if (unlikely(__Pyx_Generator_CheckRunning(gen)))
+ return NULL;
+ if (yf) {
+ PyObject *ret;
+ gen->is_running = 1;
+ if (__Pyx_Generator_CheckExact(yf)) {
+ ret = __Pyx_Generator_Send(yf, value);
+ } else {
+ if (value == Py_None)
+ ret = PyIter_Next(yf);
+ else
+ ret = PyObject_CallMethod(yf, (char*)"send", (char*)"O", value);
+ }
+ gen->is_running = 0;
+ if (likely(ret)) {
+ return ret;
+ }
+ return __Pyx_Generator_FinishDelegation(gen);
+ }
+ return __Pyx_Generator_SendEx(gen, value);
+}
+static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) {
+ PyObject *retval = NULL;
+ int err = 0;
+ if (__Pyx_Generator_CheckExact(yf)) {
+ retval = __Pyx_Generator_Close(yf);
+ if (!retval)
+ return -1;
+ } else {
+ PyObject *meth;
+ gen->is_running = 1;
+ meth = PyObject_GetAttrString(yf, "close");
+ if (unlikely(!meth)) {
+ if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_WriteUnraisable(yf);
+ }
+ PyErr_Clear();
+ } else {
+ retval = PyObject_CallFunction(meth, NULL);
+ Py_DECREF(meth);
+ if (!retval)
+ err = -1;
+ }
+ gen->is_running = 0;
+ }
+ Py_XDECREF(retval);
+ return err;
}
-static PyObject *__Pyx_Generator_Close(PyObject *self)
-{
- __pyx_GeneratorObject *generator = (__pyx_GeneratorObject *) self;
- PyObject *retval;
+static PyObject *__Pyx_Generator_Close(PyObject *self) {
+ __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
+ PyObject *retval, *raised_exception;
+ PyObject *yf = gen->yieldfrom;
+ int err = 0;
+ if (unlikely(__Pyx_Generator_CheckRunning(gen)))
+ return NULL;
+ if (yf) {
+ Py_INCREF(yf);
+ err = __Pyx_Generator_CloseIter(gen, yf);
+ __Pyx_Generator_Undelegate(gen);
+ Py_DECREF(yf);
+ }
+ if (err == 0)
#if PY_VERSION_HEX < 0x02050000
- PyErr_SetNone(PyExc_StopIteration);
+ PyErr_SetNone(PyExc_StopIteration);
#else
- PyErr_SetNone(PyExc_GeneratorExit);
+ PyErr_SetNone(PyExc_GeneratorExit);
#endif
- retval = __Pyx_Generator_SendEx(generator, NULL);
+ retval = __Pyx_Generator_SendEx(gen, NULL);
if (retval) {
Py_DECREF(retval);
PyErr_SetString(PyExc_RuntimeError,
"generator ignored GeneratorExit");
return NULL;
}
-#if PY_VERSION_HEX < 0x02050000
- if (PyErr_ExceptionMatches(PyExc_StopIteration))
-#else
- if (PyErr_ExceptionMatches(PyExc_StopIteration)
- || PyErr_ExceptionMatches(PyExc_GeneratorExit))
+ raised_exception = PyErr_Occurred();
+ if (!raised_exception
+ || raised_exception == PyExc_StopIteration
+#if PY_VERSION_HEX >= 0x02050000
+ || raised_exception == PyExc_GeneratorExit
+ || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
#endif
+ || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
{
- PyErr_Clear(); /* ignore these errors */
+ if (raised_exception) PyErr_Clear(); /* ignore these errors */
Py_INCREF(Py_None);
return Py_None;
}
return NULL;
}
-static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args)
-{
- __pyx_GeneratorObject *generator = (__pyx_GeneratorObject *) self;
+static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
+ __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
PyObject *typ;
PyObject *tb = NULL;
PyObject *val = NULL;
+ PyObject *yf = gen->yieldfrom;
if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
return NULL;
+ if (unlikely(__Pyx_Generator_CheckRunning(gen)))
+ return NULL;
+ if (yf) {
+ PyObject *ret;
+ Py_INCREF(yf);
+#if PY_VERSION_HEX >= 0x02050000
+ if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
+ int err = __Pyx_Generator_CloseIter(gen, yf);
+ Py_DECREF(yf);
+ __Pyx_Generator_Undelegate(gen);
+ if (err < 0)
+ return __Pyx_Generator_SendEx(gen, NULL);
+ goto throw_here;
+ }
+#endif
+ gen->is_running = 1;
+ if (__Pyx_Generator_CheckExact(yf)) {
+ ret = __Pyx_Generator_Throw(yf, args);
+ } else {
+ PyObject *meth = PyObject_GetAttrString(yf, "throw");
+ if (unlikely(!meth)) {
+ Py_DECREF(yf);
+ if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ gen->is_running = 0;
+ return NULL;
+ }
+ PyErr_Clear();
+ __Pyx_Generator_Undelegate(gen);
+ gen->is_running = 0;
+ goto throw_here;
+ }
+ ret = PyObject_CallObject(meth, args);
+ Py_DECREF(meth);
+ }
+ gen->is_running = 0;
+ Py_DECREF(yf);
+ if (!ret) {
+ ret = __Pyx_Generator_FinishDelegation(gen);
+ }
+ return ret;
+ }
+throw_here:
__Pyx_Raise(typ, val, tb, NULL);
- return __Pyx_Generator_SendEx(generator, NULL);
+ return __Pyx_Generator_SendEx(gen, NULL);
}
-static int
-__Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg)
-{
+static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) {
__pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
Py_VISIT(gen->closure);
Py_VISIT(gen->classobj);
+ Py_VISIT(gen->yieldfrom);
Py_VISIT(gen->exc_type);
Py_VISIT(gen->exc_value);
Py_VISIT(gen->exc_traceback);
return 0;
}
-static void
-__Pyx_Generator_dealloc(PyObject *self)
-{
+static int __Pyx_Generator_clear(PyObject *self) {
+ __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
+ Py_CLEAR(gen->closure);
+ Py_CLEAR(gen->classobj);
+ Py_CLEAR(gen->yieldfrom);
+ Py_CLEAR(gen->exc_type);
+ Py_CLEAR(gen->exc_value);
+ Py_CLEAR(gen->exc_traceback);
+ return 0;
+}
+static void __Pyx_Generator_dealloc(PyObject *self) {
__pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
PyObject_GC_UnTrack(gen);
if (gen->gi_weakreflist != NULL)
@@ -30168,16 +30956,10 @@ __Pyx_Generator_dealloc(PyObject *self)
return; /* resurrected. :( */
}
PyObject_GC_UnTrack(self);
- Py_CLEAR(gen->closure);
- Py_CLEAR(gen->classobj);
- Py_CLEAR(gen->exc_type);
- Py_CLEAR(gen->exc_value);
- Py_CLEAR(gen->exc_traceback);
+ __Pyx_Generator_clear(self);
PyObject_GC_Del(gen);
}
-static void
-__Pyx_Generator_del(PyObject *self)
-{
+static void __Pyx_Generator_del(PyObject *self) {
PyObject *res;
PyObject *error_type, *error_value, *error_traceback;
__pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
@@ -30206,11 +30988,13 @@ __Pyx_Generator_del(PyObject *self)
_Py_NewReference(self);
self->ob_refcnt = refcnt;
}
+#if CYTHON_COMPILING_FOR_CPYTHON
assert(PyType_IS_GC(self->ob_type) &&
_Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
/* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so
* we need to undo that. */
_Py_DEC_REFTOTAL;
+#endif
/* If Py_TRACE_REFS, _Py_NewReference re-added self to the object
* chain, so no more to do there.
* If COUNT_ALLOCS, the original decref bumped tp_frees, and
@@ -30218,13 +31002,17 @@ __Pyx_Generator_del(PyObject *self)
* undone.
*/
#ifdef COUNT_ALLOCS
- --self->ob_type->tp_frees;
- --self->ob_type->tp_allocs;
+ --Py_TYPE(self)->tp_frees;
+ --Py_TYPE(self)->tp_allocs;
#endif
}
static PyMemberDef __pyx_Generator_memberlist[] = {
{(char *) "gi_running",
+#if PY_VERSION_HEX >= 0x02060000
+ T_BOOL,
+#else
T_INT,
+#endif
offsetof(__pyx_GeneratorObject, is_running),
READONLY,
NULL},
@@ -30236,7 +31024,7 @@ static PyMethodDef __pyx_Generator_methods[] = {
{__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_GeneratorType = {
+static PyTypeObject __pyx_GeneratorType_type = {
PyVarObject_HEAD_INIT(0, 0)
__Pyx_NAMESTR("generator"), /*tp_name*/
sizeof(__pyx_GeneratorObject), /*tp_basicsize*/
@@ -30257,7 +31045,7 @@ static PyTypeObject __pyx_GeneratorType = {
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
- PyObject_GenericGetAttr, /*tp_getattro*/
+ 0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
@@ -30266,7 +31054,7 @@ static PyTypeObject __pyx_GeneratorType = {
0, /*tp_clear*/
0, /*tp_richcompare*/
offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */
- PyObject_SelfIter, /*tp_iter*/
+ 0, /*tp_iter*/
(iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/
__pyx_Generator_methods, /*tp_methods*/
__pyx_Generator_memberlist, /*tp_members*/
@@ -30291,12 +31079,10 @@ static PyTypeObject __pyx_GeneratorType = {
0, /*tp_version_tag*/
#endif
};
-static
-__pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
- PyObject *closure)
-{
+static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
+ PyObject *closure) {
__pyx_GeneratorObject *gen =
- PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType);
+ PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type);
if (gen == NULL)
return NULL;
gen->body = body;
@@ -30305,6 +31091,7 @@ __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
gen->is_running = 0;
gen->resume_label = 0;
gen->classobj = NULL;
+ gen->yieldfrom = NULL;
gen->exc_type = NULL;
gen->exc_value = NULL;
gen->exc_traceback = NULL;
@@ -30312,9 +31099,14 @@ __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
PyObject_GC_Track(gen);
return gen;
}
-static int __pyx_Generator_init(void)
-{
- return PyType_Ready(&__pyx_GeneratorType);
+static int __pyx_Generator_init(void) {
+ __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
+ __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
+ if (PyType_Ready(&__pyx_GeneratorType_type)) {
+ return -1;
+ }
+ __pyx_GeneratorType = &__pyx_GeneratorType_type;
+ return 0;
}
static int __Pyx_check_binary_version(void) {
diff --git a/python/src/_cdec.pyx b/python/src/_cdec.pyx
index e93474fe..af4e5f2f 100644
--- a/python/src/_cdec.pyx
+++ b/python/src/_cdec.pyx
@@ -25,6 +25,9 @@ decoder.register_feature_functions()
class InvalidConfig(Exception): pass
class ParseFailed(Exception): pass
+def set_silent(yn):
+ SetSilent(yn)
+
def _make_config(config):
for key, value in config.items():
if isinstance(value, dict):
@@ -82,7 +85,7 @@ cdef class Decoder:
property formalism:
def __get__(self):
cdef variables_map* conf = &self.dec.GetConf()
- return conf[0]['formalism'].as_str()
+ return conf[0]['formalism'].as_str().c_str()
def read_weights(self, weights):
with open(weights) as fp:
diff --git a/python/src/decoder.pxd b/python/src/decoder.pxd
index a66166a2..b68b836e 100644
--- a/python/src/decoder.pxd
+++ b/python/src/decoder.pxd
@@ -15,9 +15,8 @@ cdef extern from "decoder/decoder.h":
DecoderObserver()
cdef cppclass Decoder:
- Decoder(int argc, char** argv)
- Decoder(istream* config_file)
- bint Decode(string& inp, DecoderObserver* observer)
+ Decoder(istream* config_file) nogil
+ bint Decode(string& inp, DecoderObserver* observer) nogil
# access this to either *read* or *write* to the decoder's last
# weight vector (i.e., the weights of the finest past)
@@ -27,8 +26,8 @@ cdef extern from "decoder/decoder.h":
variables_map& GetConf()
# add grammar rules (currently only supported by SCFG decoders)
- void AddSupplementalGrammarFromString(string& grammar_str)
- void AddSupplementalGrammar(shared_ptr[Grammar] grammar)
+ void AddSupplementalGrammarFromString(string& grammar_str) nogil
+ void AddSupplementalGrammar(shared_ptr[Grammar] grammar) nogil
cdef extern from "observer.h":
cdef cppclass BasicObserver(DecoderObserver):
diff --git a/python/src/grammar.pxd b/python/src/grammar.pxd
index 833de2e3..0ffe80fa 100644
--- a/python/src/grammar.pxd
+++ b/python/src/grammar.pxd
@@ -35,11 +35,9 @@ cdef extern from "decoder/grammar.h":
cdef cppclass Grammar:
const_GrammarIter* GetRoot()
- bint HasRuleForSpan(int i, int j, int distance)
- unsigned GetCTFLevels()
string GetGrammarName()
void SetGrammarName(string)
cdef cppclass TextGrammar(Grammar):
TextGrammar()
- void AddRule(shared_ptr[TRule]& rule)
+ void AddRule(shared_ptr[TRule]& rule) nogil
diff --git a/python/src/hypergraph.pxd b/python/src/hypergraph.pxd
index abd6759c..1ddc2e5d 100644
--- a/python/src/hypergraph.pxd
+++ b/python/src/hypergraph.pxd
@@ -31,30 +31,30 @@ cdef extern from "decoder/hg.h":
ctypedef HypergraphNode const_HypergraphNode "const Hypergraph::Node"
cdef cppclass Hypergraph:
- Hypergraph(Hypergraph)
+ Hypergraph(Hypergraph) nogil
vector[HypergraphNode] nodes_
vector[HypergraphEdge] edges_
int GoalNode()
double NumberOfPaths()
- void Reweight(vector[weight_t]& weights)
- void Reweight(FastSparseVector& weights)
+ void Reweight(vector[weight_t]& weights) nogil
+ void Reweight(FastSparseVector& weights) nogil
bint PruneInsideOutside(double beam_alpha,
double density,
EdgeMask* preserve_mask,
bint use_sum_prod_semiring,
double scale,
- bint safe_inside)
+ bint safe_inside) nogil
cdef extern from "decoder/viterbi.h":
- prob_t ViterbiESentence(Hypergraph& hg, vector[WordID]* trans)
- string ViterbiETree(Hypergraph& hg)
- prob_t ViterbiFSentence(Hypergraph& hg, vector[WordID]* trans)
- string ViterbiFTree(Hypergraph& hg)
- FastSparseVector[weight_t] ViterbiFeatures(Hypergraph& hg)
+ prob_t ViterbiESentence(Hypergraph& hg, vector[WordID]* trans) nogil
+ string ViterbiETree(Hypergraph& hg) nogil
+ prob_t ViterbiFSentence(Hypergraph& hg, vector[WordID]* trans) nogil
+ string ViterbiFTree(Hypergraph& hg) nogil
+ FastSparseVector[weight_t] ViterbiFeatures(Hypergraph& hg) nogil
FastSparseVector[weight_t] ViterbiFeatures(Hypergraph& hg,
FastSparseVector[weight_t]* weights,
- bint fatal_dotprod_disagreement)
- string JoshuaVisualizationString(Hypergraph& hg)
+ bint fatal_dotprod_disagreement) nogil
+ string JoshuaVisualizationString(Hypergraph& hg) nogil
cdef extern from "decoder/hg_io.h" namespace "HypergraphIO":
bint ReadFromJSON(istream* inp, Hypergraph* out)
@@ -65,7 +65,7 @@ cdef extern from "decoder/hg_io.h" namespace "HypergraphIO":
string AsPLF(Lattice& lat, bint include_global_parentheses)
cdef extern from "decoder/hg_intersect.h" namespace "HG":
- bint Intersect(Lattice& target, Hypergraph* hg)
+ bint Intersect(Lattice& target, Hypergraph* hg) nogil
cdef extern from "decoder/hg_sampler.h" namespace "HypergraphSampler":
cdef cppclass Hypothesis:
@@ -75,14 +75,14 @@ cdef extern from "decoder/hg_sampler.h" namespace "HypergraphSampler":
void sample_hypotheses(Hypergraph& hg,
unsigned n,
MT19937* rng,
- vector[Hypothesis]* hypos)
+ vector[Hypothesis]* hypos) nogil
void sample_trees(Hypergraph& hg,
unsigned n,
MT19937* rng,
- vector[string]* trees)
+ vector[string]* trees) nogil
cdef extern from "decoder/csplit.h" namespace "CompoundSplit":
int GetFullWordEdgeIndex(Hypergraph& forest)
cdef extern from "decoder/inside_outside.h":
- prob_t InsideOutside "InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>" (Hypergraph& hg, FastSparseVector[prob_t]* result)
+ prob_t InsideOutside "InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>" (Hypergraph& hg, FastSparseVector[prob_t]* result) nogil
diff --git a/python/src/hypergraph.pxi b/python/src/hypergraph.pxi
index 62dd5bb1..f0312a12 100644
--- a/python/src/hypergraph.pxi
+++ b/python/src/hypergraph.pxi
@@ -10,6 +10,11 @@ cdef class Hypergraph:
if self.rng != NULL:
del self.rng
+ cdef MT19937* _rng(self):
+ if self.rng == NULL:
+ self.rng = new MT19937()
+ return self.rng
+
def viterbi(self):
cdef vector[WordID] trans
hypergraph.ViterbiESentence(self.hg[0], &trans)
@@ -75,9 +80,7 @@ cdef class Hypergraph:
def sample(self, unsigned n):
cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
- if self.rng == NULL:
- self.rng = new MT19937()
- hypergraph.sample_hypotheses(self.hg[0], n, self.rng, hypos)
+ hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos)
cdef unsigned k
try:
for k in range(hypos.size()):
@@ -87,9 +90,7 @@ cdef class Hypergraph:
def sample_trees(self, unsigned n):
cdef vector[string]* trees = new vector[string]()
- if self.rng == NULL:
- self.rng = new MT19937()
- hypergraph.sample_trees(self.hg[0], n, self.rng, trees)
+ hypergraph.sample_trees(self.hg[0], n, self._rng(), trees)
cdef unsigned k
try:
for k in range(trees.size()):
diff --git a/python/src/kbest.pxd b/python/src/kbest.pxd
index cef42bd3..44ecfbab 100644
--- a/python/src/kbest.pxd
+++ b/python/src/kbest.pxd
@@ -16,5 +16,5 @@ cdef extern from "decoder/kbest.h" namespace "KBest":
cdef cppclass KBestDerivations[T, Traversal]:
cppclass Derivation:
T _yield "yield"
- KBestDerivations(Hypergraph& hg, unsigned k)
- Derivation* LazyKthBest(unsigned v, unsigned k)
+ KBestDerivations(Hypergraph& hg, unsigned k) nogil
+ Derivation* LazyKthBest(unsigned v, unsigned k) nogil