summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-08-09 01:18:51 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2012-08-09 01:18:51 -0400
commit8ab7731dc55c55272300eafbde2c085b31f886d7 (patch)
treeb893065295b1cee0d30deadc6331f9c2fab1e864
parentc732ab57899e33c62dad2154ac6ca1caeaaa7789 (diff)
parenteae5efbf112a8697309fe7c1e385a8609124520e (diff)
Merge branch 'master' of github.com:redpony/cdec
-rw-r--r--.gitignore1
-rw-r--r--decoder/hg_sampler.cc2
-rw-r--r--python/pkg/cdec/__init__.py3
-rw-r--r--python/setup.py54
-rw-r--r--python/src/_cdec.cpp2833
-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
11 files changed, 1732 insertions, 1226 deletions
diff --git a/.gitignore b/.gitignore
index 571360ed..9c60cfcc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,6 +32,7 @@ rampion/rampion_cccp
rst_parser/mst_train
rst_parser/rst_parse
rst_parser/rst_train
+rst_parser/random_tree
training/liblbfgs/bin/
training/liblbfgs/ll_test
utils/atools
diff --git a/decoder/hg_sampler.cc b/decoder/hg_sampler.cc
index c4d3dede..8e520871 100644
--- a/decoder/hg_sampler.cc
+++ b/decoder/hg_sampler.cc
@@ -122,7 +122,7 @@ void HypergraphSampler::sample_trees(const Hypergraph& hg,
}
vector<WordID> tmp;
Viterbi(hg, &tmp, ETreeTraversal(), SampledDerivationWeightFunction(sampled_edges));
- (*trees)[n] = TD::GetString(tmp);
+ (*trees)[i] = TD::GetString(tmp);
}
}
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 dcd33448..87b836f1 100644
--- a/python/src/_cdec.cpp
+++ b/python/src/_cdec.cpp
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.17.beta1 on Sun Jul 29 23:00:27 2012 */
+/* Generated by Cython 0.17.beta1 on Wed Aug 8 18:52:57 2012 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -399,19 +399,18 @@ static const char *__pyx_f[] = {
"hypergraph.pxi",
"lattice.pxi",
"mteval.pxi",
- "stringsource",
"cdec.sa._sa.pxd",
};
/*--- Type declarations ---*/
struct __pyx_obj_5_cdec_Scorer;
struct __pyx_obj_5_cdec_NTRef;
-struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__;
-struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr;
struct __pyx_obj_4cdec_2sa_3_sa_Phrase;
+struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__;
struct __pyx_obj_5_cdec_Grammar;
+struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines;
+struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees;
struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__;
-struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot;
struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase;
struct __pyx_obj_5_cdec_CandidateSet;
struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__;
@@ -419,18 +418,21 @@ struct __pyx_obj_5_cdec_TRule;
struct __pyx_obj_4cdec_2sa_3_sa_Rule;
struct __pyx_obj_5_cdec_MRule;
struct __pyx_obj_5_cdec_SegmentEvaluator;
-struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__;
+struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr;
+struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot;
struct __pyx_obj_5_cdec_Candidate;
struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr;
struct __pyx_obj_5_cdec_NT;
+struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__;
struct __pyx_obj_5_cdec_HypergraphEdge;
struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__;
struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__;
struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__;
+struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__;
struct __pyx_obj_5_cdec_Decoder;
struct __pyx_obj_5_cdec_HypergraphNode;
struct __pyx_obj_5_cdec_SparseVector;
-struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__;
+struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__;
struct __pyx_obj_5_cdec___pyx_scope_struct____iter__;
struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__;
struct __pyx_obj_5_cdec_DenseVector;
@@ -446,10 +448,8 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees;
struct __pyx_obj_5_cdec_Hypergraph;
struct __pyx_obj_5_cdec_Lattice;
struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample;
-struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__;
-struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config;
+struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config;
struct __pyx_obj_5_cdec_TextGrammar;
-struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines;
struct __pyx_opt_args_5_cdec_as_str;
/* "_cdec.pyx":6
@@ -491,36 +491,6 @@ struct __pyx_obj_5_cdec_NTRef {
};
-/* "_cdec.pyx":43
- * cdef DenseVector weights
- *
- * def __cinit__(self, config_str=None, **config): # <<<<<<<<<<<<<<
- * """ Configuration can be given as a string:
- * Decoder('formalism = scfg')
- */
-struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ {
- PyObject_HEAD
- PyObject *__pyx_v_config;
-};
-
-
-/* "_cdec.pyx":54
- * '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)
- */
-struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr {
- PyObject_HEAD
- struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *__pyx_outer_scope;
- PyObject *__pyx_v_kv;
- PyObject *__pyx_t_0;
- Py_ssize_t __pyx_t_1;
- PyObject *(*__pyx_t_2)(PyObject *);
-};
-
-
/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":1
* cdef class Phrase: # <<<<<<<<<<<<<<
* cdef int *syms
@@ -536,6 +506,22 @@ struct __pyx_obj_4cdec_2sa_3_sa_Phrase {
};
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":90
+ * return candidate
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(len(self)):
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ {
+ PyObject_HEAD
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self;
+ Py_ssize_t __pyx_t_0;
+ unsigned int __pyx_t_1;
+};
+
+
/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":181
* super(MRule, self).__init__(lhs, rhs, e, scores, a)
*
@@ -549,32 +535,60 @@ struct __pyx_obj_5_cdec_Grammar {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":119
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
*
- * property nodes:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.hg.nodes_.size()):
+ * def todot(self):
+ * def lines(): # <<<<<<<<<<<<<<
+ * yield 'digraph lattice {'
+ * yield 'rankdir = LR;'
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ {
+struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines {
PyObject_HEAD
- unsigned int __pyx_v_i;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *__pyx_outer_scope;
+ PyObject *__pyx_v_delta;
+ PyObject *__pyx_v_i;
+ PyObject *__pyx_v_label;
+ PyObject *__pyx_v_weight;
+ Py_ssize_t __pyx_t_0;
+ PyObject *__pyx_t_1;
+ PyObject *(*__pyx_t_2)(PyObject *);
+ PyObject *__pyx_t_3;
+ Py_ssize_t __pyx_t_4;
+ PyObject *(*__pyx_t_5)(PyObject *);
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":91
+ * del hypos
+ *
+ * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
+ * cdef vector[string]* trees = new vector[string]()
+ * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees)
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees {
+ PyObject_HEAD
+ unsigned int __pyx_v_k;
+ unsigned int __pyx_v_n;
struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self;
+ std::vector<std::string> *__pyx_v_trees;
size_t __pyx_t_0;
unsigned int __pyx_t_1;
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":57
- * yield self[i]
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":126
*
- * def todot(self): # <<<<<<<<<<<<<<
- * def lines():
- * yield 'digraph lattice {'
+ * property edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.edges_.size()):
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot {
+struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ {
PyObject_HEAD
- struct __pyx_obj_5_cdec_Lattice *__pyx_v_self;
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
@@ -606,18 +620,18 @@ struct __pyx_obj_5_cdec_CandidateSet {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":167
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":132
*
- * property tail_nodes:
+ * property nodes:
* def __get__(self): # <<<<<<<<<<<<<<
* cdef unsigned i
- * for i in range(self.edge.tail_nodes_.size()):
+ * for i in range(self.hg.nodes_.size()):
*/
struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ {
PyObject_HEAD
unsigned int __pyx_v_i;
- struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self;
- unsigned int __pyx_t_0;
+ struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self;
+ size_t __pyx_t_0;
unsigned int __pyx_t_1;
};
@@ -679,22 +693,27 @@ struct __pyx_obj_5_cdec_SegmentEvaluator {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":44
- * return self.stats.size()
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * for i in range(len(self)):
- * yield self[i]
+/* "_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)
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ {
+struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr {
PyObject_HEAD
- PyObject *__pyx_v_i;
- struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self;
- Py_ssize_t __pyx_t_0;
- PyObject *__pyx_t_1;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ *__pyx_outer_scope;
+ PyObject *__pyx_v_kv;
+ PyObject *__pyx_t_0;
+ Py_ssize_t __pyx_t_1;
PyObject *(*__pyx_t_2)(PyObject *);
};
+struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot {
+ PyObject_HEAD
+ struct __pyx_obj_5_cdec_Lattice *__pyx_v_self;
+};
+
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":12
* return stats
@@ -741,7 +760,20 @@ struct __pyx_obj_5_cdec_NT {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":147
+/* "_cdec.pyx":46
+ * cdef DenseVector weights
+ *
+ * def __cinit__(self, config_str=None, **config): # <<<<<<<<<<<<<<
+ * """ Configuration can be given as a string:
+ * Decoder('formalism = scfg')
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ {
+ PyObject_HEAD
+ PyObject *__pyx_v_config;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":160
* return vector
*
* cdef class HypergraphEdge: # <<<<<<<<<<<<<<
@@ -774,12 +806,12 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":209
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":216
*
- * property out_edges:
+ * property in_edges:
* def __get__(self): # <<<<<<<<<<<<<<
* cdef unsigned i
- * for i in range(self.node.out_edges_.size()):
+ * for i in range(self.node.in_edges_.size()):
*/
struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ {
PyObject_HEAD
@@ -807,7 +839,23 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ {
};
-/* "_cdec.pyx":39
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":52
+ * return hypergraph.AsPLF(self.lattice[0], True).c_str()
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(len(self)):
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ {
+ PyObject_HEAD
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_5_cdec_Lattice *__pyx_v_self;
+ Py_ssize_t __pyx_t_0;
+ unsigned int __pyx_t_1;
+};
+
+
+/* "_cdec.pyx":42
* yield key, bytes(value)
*
* cdef class Decoder: # <<<<<<<<<<<<<<
@@ -821,7 +869,7 @@ struct __pyx_obj_5_cdec_Decoder {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":193
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":206
* raise NotImplemented('comparison not implemented for HypergraphEdge')
*
* cdef class HypergraphNode: # <<<<<<<<<<<<<<
@@ -849,18 +897,18 @@ struct __pyx_obj_5_cdec_SparseVector {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":52
- * return hypergraph.AsPLF(self.lattice[0], True).c_str()
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":222
*
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(len(self)):
+ * property out_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.out_edges_.size()):
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ {
+struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ {
PyObject_HEAD
unsigned int __pyx_v_i;
- struct __pyx_obj_5_cdec_Lattice *__pyx_v_self;
- Py_ssize_t __pyx_t_0;
+ struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self;
+ size_t __pyx_t_0;
unsigned int __pyx_t_1;
};
@@ -881,19 +929,20 @@ struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":90
- * return candidate
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":44
+ * return self.stats.size()
*
* def __iter__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
* for i in range(len(self)):
+ * yield self[i]
*/
struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ {
PyObject_HEAD
- unsigned int __pyx_v_i;
- struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self;
+ PyObject *__pyx_v_i;
+ struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self;
Py_ssize_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ PyObject *__pyx_t_1;
+ PyObject *(*__pyx_t_2)(PyObject *);
};
@@ -957,7 +1006,7 @@ struct __pyx_obj_5_cdec_SufficientStats {
};
-/* "/Users/vchahun/Sandbox/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): # <<<<<<<<<<<<<<
@@ -976,7 +1025,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":61
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":66
* del e_derivations
*
* def kbest_features(self, size): # <<<<<<<<<<<<<<
@@ -996,18 +1045,18 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":203
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":180
*
- * property in_edges:
+ * property tail_nodes:
* def __get__(self): # <<<<<<<<<<<<<<
* cdef unsigned i
- * for i in range(self.node.in_edges_.size()):
+ * for i in range(self.edge.tail_nodes_.size()):
*/
struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ {
PyObject_HEAD
unsigned int __pyx_v_i;
- struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self;
- size_t __pyx_t_0;
+ struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self;
+ unsigned int __pyx_t_0;
unsigned int __pyx_t_1;
};
@@ -1042,7 +1091,7 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":43
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":48
* del derivations
*
* def kbest_trees(self, size): # <<<<<<<<<<<<<<
@@ -1074,6 +1123,7 @@ 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;
};
@@ -1092,12 +1142,12 @@ struct __pyx_obj_5_cdec_Lattice {
};
-/* "/Users/vchahun/Sandbox/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
@@ -1110,30 +1160,14 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":113
- *
- * property edges:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.hg.edges_.size()):
- */
-struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ {
- PyObject_HEAD
- unsigned int __pyx_v_i;
- struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
-};
-
-
-/* "_cdec.pyx":28
- * class ParseFailed(Exception): pass
+/* "_cdec.pyx":31
+ * SetSilent(yn)
*
* def _make_config(config): # <<<<<<<<<<<<<<
* for key, value in config.items():
* if isinstance(value, dict):
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config {
+struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config {
PyObject_HEAD
PyObject *__pyx_v_config;
PyObject *__pyx_v_info;
@@ -1161,28 +1195,19 @@ struct __pyx_obj_5_cdec_TextGrammar {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":4
+ * cimport kbest
*
- * def todot(self):
- * def lines(): # <<<<<<<<<<<<<<
- * yield 'digraph lattice {'
- * yield 'rankdir = LR;'
+ * cdef class Hypergraph: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef MT19937* rng
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines {
- PyObject_HEAD
- struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *__pyx_outer_scope;
- PyObject *__pyx_v_delta;
- PyObject *__pyx_v_i;
- PyObject *__pyx_v_label;
- PyObject *__pyx_v_weight;
- Py_ssize_t __pyx_t_0;
- PyObject *__pyx_t_1;
- PyObject *(*__pyx_t_2)(PyObject *);
- PyObject *__pyx_t_3;
- Py_ssize_t __pyx_t_4;
- PyObject *(*__pyx_t_5)(PyObject *);
-};
+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
@@ -1198,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;
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":193
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":206
* raise NotImplemented('comparison not implemented for HypergraphEdge')
*
* cdef class HypergraphNode: # <<<<<<<<<<<<<<
@@ -1212,7 +1237,7 @@ struct __pyx_vtabstruct_5_cdec_HypergraphNode {
static struct __pyx_vtabstruct_5_cdec_HypergraphNode *__pyx_vtabptr_5_cdec_HypergraphNode;
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":147
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":160
* return vector
*
* cdef class HypergraphEdge: # <<<<<<<<<<<<<<
@@ -1732,25 +1757,25 @@ static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_8_kbest = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_9_kbest_trees = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_10_kbest_features = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_11_sample = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_12___get__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_13___get__ = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_14___get__ = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_15___get__ = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_16___get__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_17___iter__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_18_todot = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_19_lines = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_20___iter__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_17___get__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_18___iter__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_19_todot = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_20_lines = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_22__make_config = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_23___cinit__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_24_genexpr = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_22___iter__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_23__make_config = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_24___cinit__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr = 0;
static char *__pyx_f_5_cdec_as_str(PyObject *, struct __pyx_opt_args_5_cdec_as_str *__pyx_optional_args); /*proto*/
static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_obj_4cdec_2sa_3_sa_Rule *); /*proto*/
static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject *, PyObject *); /*proto*/
static float __pyx_f_5_cdec__compute_score(void *, SufficientStats *); /*proto*/
static void __pyx_f_5_cdec__compute_sufficient_stats(void *, std::string *, std::vector<std::string> *, SufficientStats *); /*proto*/
-static PyObject *__pyx_convert_string_to_py_(const std::string &); /*proto*/
#define __Pyx_MODULE_NAME "_cdec"
int __pyx_module_is_main__cdec = 0;
@@ -1840,15 +1865,16 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_10kbest(struct __pyx_obj_5_cdec_Hy
static PyObject *__pyx_pf_5_cdec_10Hypergraph_13kbest_trees(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_16kbest_features(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_19sample(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n); /* proto */
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_22intersect(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, struct __pyx_obj_5_cdec_Lattice *__pyx_v_lat); /* proto */
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_24prune(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_beam_alpha, PyObject *__pyx_v_density, PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_26lattice(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_28reweight(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_22sample_trees(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n); /* proto */
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_25intersect(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, struct __pyx_obj_5_cdec_Lattice *__pyx_v_lat); /* proto */
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_27prune(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_beam_alpha, PyObject *__pyx_v_density, PyObject *__pyx_v_kwargs); /* proto */
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_29lattice(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
@@ -1902,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 */
@@ -1955,6 +1982,7 @@ 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";
@@ -2030,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_";
@@ -2151,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;
@@ -2160,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;
@@ -2186,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
@@ -4615,7 +4648,7 @@ static PyObject *__pyx_pw_5_cdec_1_phrase(PyObject *__pyx_self, PyObject *__pyx_
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_7_phrase_2generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6
*
@@ -4643,7 +4676,7 @@ static PyObject *__pyx_pf_5_cdec_7_phrase_genexpr(PyObject *__pyx_self) {
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7_phrase_2generator17, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7_phrase_2generator18, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -4661,7 +4694,7 @@ static PyObject *__pyx_pf_5_cdec_7_phrase_genexpr(PyObject *__pyx_self) {
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_7_phrase_2generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
@@ -7513,7 +7546,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_5__str__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":165
*
@@ -7541,7 +7574,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_self) {
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_5TRule_7__str___2generator18, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_5TRule_7__str___2generator19, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -7559,7 +7592,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_self) {
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
@@ -8629,7 +8662,7 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp
* if self.rng != NULL:
* del self.rng # <<<<<<<<<<<<<<
*
- * def viterbi(self):
+ * cdef MT19937* _rng(self):
*/
delete __pyx_v_self->rng;
goto __pyx_L3;
@@ -8639,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) {
@@ -8650,8 +8744,8 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_self, C
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/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
@@ -8669,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);
- /* "/Users/vchahun/Sandbox/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) # <<<<<<<<<<<<<<
@@ -8678,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));
- /* "/Users/vchahun/Sandbox/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') # <<<<<<<<<<<<<<
@@ -8686,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));
@@ -8696,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;
@@ -8727,7 +8821,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/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): # <<<<<<<<<<<<<<
@@ -8747,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);
- /* "/Users/vchahun/Sandbox/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));
@@ -8764,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;
- /* "/Users/vchahun/Sandbox/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));
@@ -8787,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;
- /* "/Users/vchahun/Sandbox/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) # <<<<<<<<<<<<<<
@@ -8801,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));
@@ -8839,7 +8933,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_7viterbi_features(PyObject *__pyx_
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":23
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":28
* return (f_tree, e_tree)
*
* def viterbi_features(self): # <<<<<<<<<<<<<<
@@ -8857,20 +8951,20 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_features", 0);
- /* "/Users/vchahun/Sandbox/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;
- /* "/Users/vchahun/Sandbox/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])) # <<<<<<<<<<<<<<
@@ -8879,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])));
- /* "/Users/vchahun/Sandbox/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 # <<<<<<<<<<<<<<
@@ -8915,7 +9009,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_9viterbi_joshua(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":28
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":33
* return fmap
*
* def viterbi_joshua(self): # <<<<<<<<<<<<<<
@@ -8933,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);
- /* "/Users/vchahun/Sandbox/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') # <<<<<<<<<<<<<<
@@ -8941,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));
@@ -8951,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;
@@ -8983,7 +9077,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_11kbest(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/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): # <<<<<<<<<<<<<<
@@ -9012,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;
@@ -9049,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;}
- /* "/Users/vchahun/Sandbox/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);
- /* "/Users/vchahun/Sandbox/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: # <<<<<<<<<<<<<<
@@ -9070,18 +9164,18 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator4(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/Users/vchahun/Sandbox/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;
- /* "/Users/vchahun/Sandbox/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) # <<<<<<<<<<<<<<
@@ -9090,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);
- /* "/Users/vchahun/Sandbox/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 # <<<<<<<<<<<<<<
@@ -9104,16 +9198,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator4(__pyx_GeneratorObject
}
__pyx_L9:;
- /* "/Users/vchahun/Sandbox/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));
@@ -9121,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;
@@ -9136,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:;
}
- /* "/Users/vchahun/Sandbox/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 # <<<<<<<<<<<<<<
@@ -9201,7 +9295,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_14kbest_trees(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":43
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":48
* del derivations
*
* def kbest_trees(self, size): # <<<<<<<<<<<<<<
@@ -9230,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;
@@ -9269,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;}
- /* "/Users/vchahun/Sandbox/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);
- /* "/Users/vchahun/Sandbox/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);
- /* "/Users/vchahun/Sandbox/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: # <<<<<<<<<<<<<<
@@ -9300,18 +9394,18 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/Users/vchahun/Sandbox/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;
- /* "/Users/vchahun/Sandbox/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) # <<<<<<<<<<<<<<
@@ -9320,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);
- /* "/Users/vchahun/Sandbox/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) # <<<<<<<<<<<<<<
@@ -9329,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);
- /* "/Users/vchahun/Sandbox/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 # <<<<<<<<<<<<<<
@@ -9349,16 +9443,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
}
__pyx_L9:;
- /* "/Users/vchahun/Sandbox/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));
@@ -9366,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));
@@ -9375,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;
- /* "/Users/vchahun/Sandbox/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));
@@ -9392,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));
@@ -9401,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;
- /* "/Users/vchahun/Sandbox/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));
@@ -9428,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:;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":58
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":63
* yield (f_tree, e_tree)
* finally:
* del f_derivations # <<<<<<<<<<<<<<
@@ -9457,7 +9551,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator5(__pyx_GeneratorObject
__pyx_L6:;
delete __pyx_cur_scope->__pyx_v_f_derivations;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":64
* finally:
* del f_derivations
* del e_derivations # <<<<<<<<<<<<<<
@@ -9502,7 +9596,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_17kbest_features(PyObject *__pyx_v
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":61
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":66
* del e_derivations
*
* def kbest_features(self, size): # <<<<<<<<<<<<<<
@@ -9531,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;
@@ -9567,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;}
- /* "/Users/vchahun/Sandbox/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);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":66
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":71
* cdef SparseVector fmap
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -9588,18 +9682,18 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/Users/vchahun/Sandbox/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;
- /* "/Users/vchahun/Sandbox/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) # <<<<<<<<<<<<<<
@@ -9608,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);
- /* "/Users/vchahun/Sandbox/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 # <<<<<<<<<<<<<<
@@ -9622,23 +9716,23 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator6(__pyx_GeneratorObject
}
__pyx_L9:;
- /* "/Users/vchahun/Sandbox/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;
- /* "/Users/vchahun/Sandbox/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) # <<<<<<<<<<<<<<
@@ -9647,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);
- /* "/Users/vchahun/Sandbox/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 # <<<<<<<<<<<<<<
@@ -9666,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:;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":74
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":79
* yield fmap
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -9726,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:;
@@ -9739,12 +9833,12 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_20sample(PyObject *__pyx_v_self, P
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/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) {
@@ -9766,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;
@@ -9788,67 +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;
- MT19937 *__pyx_t_2;
- size_t __pyx_t_3;
- unsigned int __pyx_t_4;
- PyObject *__pyx_t_5 = NULL;
- PyObject *__pyx_t_6 = NULL;
+ size_t __pyx_t_1;
+ unsigned int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = 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;}
- /* "/Users/vchahun/Sandbox/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>();
- /* "/Users/vchahun/Sandbox/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) {
-
- /* "/Users/vchahun/Sandbox/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
- */
- try {__pyx_t_2 = new MT19937();} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
- __pyx_cur_scope->__pyx_v_self->rng = __pyx_t_2;
- goto __pyx_L4;
- }
- __pyx_L4:;
-
- /* "/Users/vchahun/Sandbox/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);
- /* "/Users/vchahun/Sandbox/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()):
@@ -9856,75 +9925,75 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator7(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/Users/vchahun/Sandbox/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_3 = __pyx_cur_scope->__pyx_v_hypos->size();
- for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
- __pyx_cur_scope->__pyx_v_k = __pyx_t_4;
+ __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;
- /* "/Users/vchahun/Sandbox/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_5 = PyBytes_FromString(TD::GetString(((__pyx_cur_scope->__pyx_v_hypos[0])[__pyx_cur_scope->__pyx_v_k]).words).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;}
- __Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+ __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_6, 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_5 = 0;
- __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
- __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
- __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
+ __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_3 = __pyx_cur_scope->__pyx_t_0;
- __pyx_t_4 = __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;}
}
}
- /* "/Users/vchahun/Sandbox/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 # <<<<<<<<<<<<<<
*
- * def intersect(self, Lattice lat):
+ * def sample_trees(self, unsigned n):
*/
/*finally:*/ {
int __pyx_why;
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_6); __pyx_t_6 = 0;
- __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: {
@@ -9940,8 +10009,8 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator7(__pyx_GeneratorObject
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_5);
- __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
@@ -9950,15 +10019,224 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator7(__pyx_GeneratorObject
__Pyx_RefNannyFinishContext();
return NULL;
}
+static PyObject *__pyx_gb_5_cdec_10Hypergraph_24generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_23intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_lat); /*proto*/
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_23intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_lat) {
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_23sample_trees(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_23sample_trees(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
+ unsigned int __pyx_v_n;
+ PyObject *__pyx_r = 0;
+ __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 = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("_cdec.Hypergraph.sample_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_22sample_trees(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((unsigned int)__pyx_v_n));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":91
+ * del hypos
+ *
+ * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
+ * cdef vector[string]* trees = new vector[string]()
+ * 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) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *__pyx_cur_scope;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("sample_trees", 0);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)__pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees, __pyx_empty_tuple, NULL);
+ if (unlikely(!__pyx_cur_scope)) {
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ }
+ __Pyx_GOTREF(__pyx_cur_scope);
+ __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
+ __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
+ __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
+ __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 = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_cur_scope);
+ __Pyx_RefNannyFinishContext();
+ return (PyObject *) gen;
+ }
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("_cdec.Hypergraph.sample_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_gb_5_cdec_10Hypergraph_24generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+{
+ 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;
+ size_t __pyx_t_1;
+ unsigned int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("None", 0);
+ switch (__pyx_generator->resume_label) {
+ case 0: goto __pyx_L3_first_run;
+ 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 = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":92
+ *
+ * def sample_trees(self, unsigned n):
+ * cdef vector[string]* trees = new vector[string]() # <<<<<<<<<<<<<<
+ * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees)
+ * cdef unsigned k
+ */
+ __pyx_cur_scope->__pyx_v_trees = new std::vector<std::string>();
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":93
+ * def sample_trees(self, unsigned n):
+ * cdef vector[string]* trees = new vector[string]()
+ * 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, ((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);
+
+ /* "/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()):
+ * yield unicode(trees[0][k].c_str(), 'utf8')
+ */
+ /*try:*/ {
+
+ /* "/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_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;
+
+ /* "/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_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_4, 1, ((PyObject *)__pyx_n_s__utf8));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ __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_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;}
+ }
+ }
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":99
+ * yield unicode(trees[0][k].c_str(), 'utf8')
+ * finally:
+ * del trees # <<<<<<<<<<<<<<
+ *
+ * def intersect(self, Lattice lat):
+ */
+ /*finally:*/ {
+ int __pyx_why;
+ 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_L6;
+ __pyx_L5: {
+ __pyx_why = 4;
+ __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_L6;
+ }
+ __pyx_L6:;
+ delete __pyx_cur_scope->__pyx_v_trees;
+ switch (__pyx_why) {
+ case 4: {
+ __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
+ __pyx_lineno = __pyx_exc_lineno;
+ __pyx_exc_type = 0;
+ __pyx_exc_value = 0;
+ __pyx_exc_tb = 0;
+ goto __pyx_L1_error;
+ }
+ }
+ }
+ PyErr_SetNone(PyExc_StopIteration);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __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;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_26intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_lat); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_26intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_lat) {
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 = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = __pyx_pf_5_cdec_10Hypergraph_22intersect(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_lat));
+ 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:;
__pyx_r = NULL;
@@ -9967,15 +10245,15 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_23intersect(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":88
- * del hypos
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":101
+ * del trees
*
* def intersect(self, Lattice lat): # <<<<<<<<<<<<<<
* return hypergraph.Intersect(lat.lattice[0], self.hg)
*
*/
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_22intersect(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, struct __pyx_obj_5_cdec_Lattice *__pyx_v_lat) {
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_25intersect(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, struct __pyx_obj_5_cdec_Lattice *__pyx_v_lat) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -9984,7 +10262,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_22intersect(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("intersect", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":89
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":102
*
* def intersect(self, Lattice lat):
* return hypergraph.Intersect(lat.lattice[0], self.hg) # <<<<<<<<<<<<<<
@@ -9992,7 +10270,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_22intersect(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 = 89; __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;
@@ -10011,8 +10289,8 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_22intersect(struct __pyx_obj_5_cde
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_25prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_25prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_28prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_28prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_beam_alpha = 0;
PyObject *__pyx_v_density = 0;
PyObject *__pyx_v_kwargs = 0;
@@ -10049,7 +10327,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_25prune(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 = 91; __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)) {
@@ -10064,20 +10342,20 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_25prune(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 = 91; __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);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_5_cdec_10Hypergraph_24prune(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), __pyx_v_beam_alpha, __pyx_v_density, __pyx_v_kwargs);
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_27prune(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), __pyx_v_beam_alpha, __pyx_v_density, __pyx_v_kwargs);
__Pyx_XDECREF(__pyx_v_kwargs);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":91
+/* "/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): # <<<<<<<<<<<<<<
@@ -10085,7 +10363,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_25prune(PyObject *__pyx_v_self, Py
* if 'csplit_preserve_full_word' in kwargs:
*/
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_24prune(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_beam_alpha, PyObject *__pyx_v_density, PyObject *__pyx_v_kwargs) {
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_27prune(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_beam_alpha, PyObject *__pyx_v_density, PyObject *__pyx_v_kwargs) {
std::vector<bool> *__pyx_v_preserve_mask;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -10097,7 +10375,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_24prune(struct __pyx_obj_5_cdec_Hy
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("prune", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":92
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":105
*
* def prune(self, beam_alpha=0, density=0, **kwargs):
* cdef hypergraph.EdgeMask* preserve_mask = NULL # <<<<<<<<<<<<<<
@@ -10106,17 +10384,17 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_24prune(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_preserve_mask = NULL;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":93
+ /* "/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 = 93; __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) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":94
+ /* "/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()) # <<<<<<<<<<<<<<
@@ -10125,7 +10403,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_24prune(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_preserve_mask = new std::vector<bool>(__pyx_v_self->hg->edges_.size());
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":95
+ /* "/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 # <<<<<<<<<<<<<<
@@ -10137,18 +10415,18 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_24prune(struct __pyx_obj_5_cdec_Hy
}
__pyx_L3:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":96
+ /* "/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 = 96; __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 = 96; __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);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":97
+ /* "/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: # <<<<<<<<<<<<<<
@@ -10158,7 +10436,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_24prune(struct __pyx_obj_5_cdec_Hy
__pyx_t_1 = (__pyx_v_preserve_mask != 0);
if (__pyx_t_1) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":98
+ /* "/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 # <<<<<<<<<<<<<<
@@ -10182,17 +10460,17 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_24prune(struct __pyx_obj_5_cdec_Hy
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_27lattice(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_27lattice(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_30lattice(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_30lattice(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("lattice (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_10Hypergraph_26lattice(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_29lattice(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":100
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":113
* del preserve_mask
*
* def lattice(self): # TODO direct hg -> lattice conversion in cdec # <<<<<<<<<<<<<<
@@ -10200,7 +10478,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_27lattice(PyObject *__pyx_v_self,
* return Lattice(eval(plf))
*/
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_26lattice(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_29lattice(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_v_plf = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -10212,20 +10490,20 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_26lattice(struct __pyx_obj_5_cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lattice", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":101
+ /* "/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 = 101; __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 = 101; __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;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":102
+ /* "/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)) # <<<<<<<<<<<<<<
@@ -10233,17 +10511,17 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_26lattice(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 = 102; __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 = 102; __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 = 102; __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 = 102; __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 = 102; __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));
@@ -10254,15 +10532,15 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_26lattice(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 = 102; __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 = 102; __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 = 102; __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;
@@ -10285,17 +10563,17 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_26lattice(struct __pyx_obj_5_cdec_
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_29reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_29reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights) {
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_32reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_32reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("reweight (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_10Hypergraph_28reweight(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_weights));
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_31reweight(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_weights));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":104
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":117
* return Lattice(eval(plf))
*
* def reweight(self, weights): # <<<<<<<<<<<<<<
@@ -10303,7 +10581,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_29reweight(PyObject *__pyx_v_self,
* self.hg.Reweight((<SparseVector> weights).vector[0])
*/
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_28reweight(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights) {
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_31reweight(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -10314,7 +10592,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_28reweight(struct __pyx_obj_5_cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("reweight", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":105
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":118
*
* def reweight(self, weights):
* if isinstance(weights, SparseVector): # <<<<<<<<<<<<<<
@@ -10327,7 +10605,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_28reweight(struct __pyx_obj_5_cdec
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":106
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":119
* def reweight(self, weights):
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0]) # <<<<<<<<<<<<<<
@@ -10338,7 +10616,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_28reweight(struct __pyx_obj_5_cdec
goto __pyx_L3;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":107
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":120
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0])
* elif isinstance(weights, DenseVector): # <<<<<<<<<<<<<<
@@ -10351,7 +10629,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_28reweight(struct __pyx_obj_5_cdec
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":108
+ /* "/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]) # <<<<<<<<<<<<<<
@@ -10363,26 +10641,26 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_28reweight(struct __pyx_obj_5_cdec
}
/*else*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":110
+ /* "/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 = 110; __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 = 110; __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 = 110; __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 = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -10398,7 +10676,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_28reweight(struct __pyx_obj_5_cdec
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_self); /*proto*/
@@ -10411,7 +10689,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":113
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":126
*
* property edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -10420,14 +10698,14 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_
*/
static PyObject *__pyx_pf_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_12___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_12___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_13___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_13___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -10437,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_2generator8, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __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;
@@ -10455,9 +10733,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_5_
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
size_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -10473,9 +10751,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator8(__pyx_Generator
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __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;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":115
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":128
* def __get__(self):
* cdef unsigned i
* for i in range(self.hg.edges_.size()): # <<<<<<<<<<<<<<
@@ -10486,16 +10764,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator8(__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;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":116
+ /* "/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 = 116; __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 = 116; __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;
@@ -10510,7 +10788,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator8(__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 = 116; __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;
@@ -10525,7 +10803,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator8(__pyx_Generator
__Pyx_RefNannyFinishContext();
return NULL;
}
-static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_self); /*proto*/
@@ -10538,7 +10816,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":119
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":132
*
* property nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -10547,14 +10825,14 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_
*/
static PyObject *__pyx_pf_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_13___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_13___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_14___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_14___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -10564,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_2generator9, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 119; __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;
@@ -10582,9 +10860,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_5_
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
size_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -10600,9 +10878,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator9(__pyx_Generator
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 119; __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;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":121
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":134
* def __get__(self):
* cdef unsigned i
* for i in range(self.hg.nodes_.size()): # <<<<<<<<<<<<<<
@@ -10613,16 +10891,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_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;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":122
+ /* "/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 = 122; __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 = 122; __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;
@@ -10637,7 +10915,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_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 = 122; __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;
@@ -10664,7 +10942,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":125
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":138
*
* property goal:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -10682,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);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":126
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":139
* property goal:
* def __get__(self):
* return HypergraphNode().init(self.hg, self.hg.GoalNode()) # <<<<<<<<<<<<<<
@@ -10690,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 = 126; __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 = 126; __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;
@@ -10723,7 +11001,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *__pyx_v
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":129
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":142
*
* property npaths:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -10740,7 +11018,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":130
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":143
* property npaths:
* def __get__(self):
* return self.hg.NumberOfPaths() # <<<<<<<<<<<<<<
@@ -10748,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 = 130; __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;
@@ -10767,17 +11045,17 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_31inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_31inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_34inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_34inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("inside_outside (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_10Hypergraph_30inside_outside(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_33inside_outside(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":132
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":145
* return self.hg.NumberOfPaths()
*
* def inside_outside(self): # <<<<<<<<<<<<<<
@@ -10785,7 +11063,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_31inside_outside(PyObject *__pyx_v
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result)
*/
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_33inside_outside(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
FastSparseVector<prob_t> *__pyx_v_result;
prob_t __pyx_v_z;
struct __pyx_obj_5_cdec_SparseVector *__pyx_v_vector = 0;
@@ -10801,7 +11079,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("inside_outside", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":133
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":146
*
* def inside_outside(self):
* cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() # <<<<<<<<<<<<<<
@@ -10810,7 +11088,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_
*/
__pyx_v_result = new FastSparseVector<prob_t>();
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":134
+ /* "/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) # <<<<<<<<<<<<<<
@@ -10819,7 +11097,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_
*/
__pyx_v_z = InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>((__pyx_v_self->hg[0]), __pyx_v_result);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":135
+ /* "/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 # <<<<<<<<<<<<<<
@@ -10828,20 +11106,20 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_
*/
(__pyx_v_result[0]) /= __pyx_v_z;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":136
+ /* "/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 = 136; __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 = 136; __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;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":137
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":150
* result[0] /= z
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double]() # <<<<<<<<<<<<<<
@@ -10850,7 +11128,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_
*/
__pyx_v_vector->vector = new FastSparseVector<double>();
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":138
+ /* "/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) # <<<<<<<<<<<<<<
@@ -10859,7 +11137,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_
*/
__pyx_v_it = new FastSparseVector<prob_t>::const_iterator((__pyx_v_result[0]), 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":140
+ /* "/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()): # <<<<<<<<<<<<<<
@@ -10870,7 +11148,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_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;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":141
+ /* "/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)) # <<<<<<<<<<<<<<
@@ -10879,7 +11157,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_
*/
__pyx_v_vector->vector->set_value((__pyx_v_it[0]).operator->()->first, log((__pyx_v_it[0]).operator->()->second));
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":142
+ /* "/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 # <<<<<<<<<<<<<<
@@ -10889,7 +11167,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_
(++(__pyx_v_it[0]));
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":143
+ /* "/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 # <<<<<<<<<<<<<<
@@ -10898,7 +11176,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_
*/
delete __pyx_v_it;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":144
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":157
* pinc(it[0]) # ++it
* del it
* del result # <<<<<<<<<<<<<<
@@ -10907,7 +11185,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_
*/
delete __pyx_v_result;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":145
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":158
* del it
* del result
* return vector # <<<<<<<<<<<<<<
@@ -10932,7 +11210,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_30inside_outside(struct __pyx_obj_
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":152
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":165
* cdef public TRule trule
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
@@ -10949,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);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":153
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":166
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg # <<<<<<<<<<<<<<
@@ -10958,7 +11236,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->hg = __pyx_v_hg;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":154
+ /* "/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] # <<<<<<<<<<<<<<
@@ -10967,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]));
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":155
+ /* "/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 = 155; __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 = 155; __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;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":156
+ /* "/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_) # <<<<<<<<<<<<<<
@@ -10992,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_);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":157
+ /* "/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 # <<<<<<<<<<<<<<
@@ -11027,7 +11305,7 @@ static Py_ssize_t __pyx_pw_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":159
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":172
* return self
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -11040,7 +11318,7 @@ static Py_ssize_t __pyx_pf_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":160
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":173
*
* def __len__(self):
* return self.edge.tail_nodes_.size() # <<<<<<<<<<<<<<
@@ -11067,7 +11345,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject *
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":163
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":176
*
* property head_node:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11085,7 +11363,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":164
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":177
* property head_node:
* def __get__(self):
* return HypergraphNode().init(self.hg, self.edge.head_node_) # <<<<<<<<<<<<<<
@@ -11093,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 = 164; __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 = 164; __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;
@@ -11114,7 +11392,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __py
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject *__pyx_v_self); /*proto*/
@@ -11127,7 +11405,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":167
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":180
*
* property tail_nodes:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11136,14 +11414,14 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject
*/
static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_14___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_14___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_15___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_15___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -11153,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_2generator10, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __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;
@@ -11171,9 +11449,9 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
unsigned int __pyx_t_1;
unsigned int __pyx_t_2;
@@ -11189,9 +11467,9 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator10(__py
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __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;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":169
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":182
* def __get__(self):
* cdef unsigned i
* for i in range(self.edge.tail_nodes_.size()): # <<<<<<<<<<<<<<
@@ -11202,16 +11480,16 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator10(__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;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":170
+ /* "/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 = 170; __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 = 170; __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;
@@ -11226,7 +11504,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator10(__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 = 170; __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;
@@ -11253,7 +11531,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":173
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":186
*
* property span:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11272,7 +11550,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":174
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":187
* property span:
* def __get__(self):
* return (self.edge.i_, self.edge.j_) # <<<<<<<<<<<<<<
@@ -11280,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 = 174; __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 = 174; __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 = 174; __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);
@@ -11321,7 +11599,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyOb
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":177
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":190
*
* property feature_values:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11339,20 +11617,20 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":178
+ /* "/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 = 178; __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 = 178; __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;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":179
+ /* "/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_) # <<<<<<<<<<<<<<
@@ -11361,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_);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":180
+ /* "/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 # <<<<<<<<<<<<<<
@@ -11397,7 +11675,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":183
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":196
*
* property prob:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11414,7 +11692,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":184
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":197
* property prob:
* def __get__(self):
* return self.edge.edge_prob_.as_float() # <<<<<<<<<<<<<<
@@ -11422,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 = 184; __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;
@@ -11446,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 = 186; __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 = 186; __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:;
@@ -11457,7 +11735,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":186
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":199
* return self.edge.edge_prob_.as_float()
*
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<<
@@ -11475,7 +11753,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":189
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":202
* if op == 2: # ==
* return x.edge == y.edge
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -11484,7 +11762,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*/
switch (__pyx_v_op) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":187
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":200
*
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -11493,7 +11771,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*/
case 2:
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":188
+ /* "/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 # <<<<<<<<<<<<<<
@@ -11501,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 = 188; __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;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":189
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":202
* if op == 2: # ==
* return x.edge == y.edge
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -11517,7 +11795,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
*/
case 3:
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":190
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":203
* return x.edge == y.edge
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
@@ -11525,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 = 190; __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 = 190; __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 = 190; __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;
@@ -11537,18 +11815,18 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_
break;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":191
+ /* "/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 = 191; __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 = 191; __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;
@@ -11573,7 +11851,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__py
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":150
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":163
* cdef hypergraph.Hypergraph* hg
* cdef hypergraph.HypergraphEdge* edge
* cdef public TRule trule # <<<<<<<<<<<<<<
@@ -11615,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 = 150; __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);
@@ -11658,7 +11936,7 @@ static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_5_c
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":197
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":210
* cdef hypergraph.HypergraphNode* node
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
@@ -11671,7 +11949,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("init", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":198
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":211
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg # <<<<<<<<<<<<<<
@@ -11680,7 +11958,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy
*/
__pyx_v_self->hg = __pyx_v_hg;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":199
+ /* "/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] # <<<<<<<<<<<<<<
@@ -11689,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]));
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":200
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":213
* self.hg = hg
* self.node = &hg.nodes_[i]
* return self # <<<<<<<<<<<<<<
@@ -11707,7 +11985,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *__pyx_v_self); /*proto*/
@@ -11720,7 +11998,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *_
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":203
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":216
*
* property in_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11729,14 +12007,14 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *_
*/
static PyObject *__pyx_pf_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_15___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_15___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_16___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_16___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -11746,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_2generator11, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __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;
@@ -11764,9 +12042,9 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
size_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -11782,9 +12060,9 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator11(__pyx_G
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __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;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":205
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":218
* def __get__(self):
* cdef unsigned i
* for i in range(self.node.in_edges_.size()): # <<<<<<<<<<<<<<
@@ -11795,16 +12073,16 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator11(__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;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":206
+ /* "/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 = 206; __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 = 206; __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;
@@ -11819,7 +12097,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator11(__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 = 206; __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;
@@ -11834,7 +12112,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator11(__pyx_G
__Pyx_RefNannyFinishContext();
return NULL;
}
-static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *__pyx_v_self); /*proto*/
@@ -11847,7 +12125,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":209
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":222
*
* property out_edges:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11856,14 +12134,14 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *
*/
static PyObject *__pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_16___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_16___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_17___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_17___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -11873,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_2generator12, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 209; __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;
@@ -11891,9 +12169,9 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(struct __py
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
size_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -11909,9 +12187,9 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator12(__pyx_
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 209; __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;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":211
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":224
* def __get__(self):
* cdef unsigned i
* for i in range(self.node.out_edges_.size()): # <<<<<<<<<<<<<<
@@ -11922,16 +12200,16 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator12(__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;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":212
+ /* "/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 = 212; __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 = 212; __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;
@@ -11946,7 +12224,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator12(__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 = 212; __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;
@@ -11973,7 +12251,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":215
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":228
*
* property span:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -11991,7 +12269,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":216
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":229
* property span:
* def __get__(self):
* return next(self.in_edges).span # <<<<<<<<<<<<<<
@@ -11999,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 = 216; __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 = 216; __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 = 216; __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;
@@ -12035,7 +12313,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":219
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":232
*
* property cat:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -12052,7 +12330,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":220
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":233
* property cat:
* def __get__(self):
* if self.node.cat_: # <<<<<<<<<<<<<<
@@ -12061,7 +12339,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_
*/
if (__pyx_v_self->node->cat_) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":221
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":234
* def __get__(self):
* if self.node.cat_:
* return TDConvert(-self.node.cat_) # <<<<<<<<<<<<<<
@@ -12069,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 = 221; __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;
@@ -12096,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 = 223; __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 = 223; __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:;
@@ -12107,7 +12385,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":223
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":236
* return TDConvert(-self.node.cat_)
*
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<<
@@ -12125,7 +12403,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":226
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":239
* if op == 2: # ==
* return x.node == y.node
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -12134,7 +12412,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
*/
switch (__pyx_v_op) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":224
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":237
*
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -12143,7 +12421,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
*/
case 2:
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":225
+ /* "/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 # <<<<<<<<<<<<<<
@@ -12151,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 = 225; __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;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":226
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":239
* if op == 2: # ==
* return x.node == y.node
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -12167,18 +12445,18 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
*/
case 3:
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":227
+ /* "/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 = 227; __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 = 227; __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 = 227; __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;
@@ -12186,16 +12464,16 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5
break;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":228
+ /* "/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 = 228; __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 = 228; __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;
@@ -13069,7 +13347,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_10__str__(struct __pyx_obj_5_cdec_Latt
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_7Lattice_14generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_7Lattice_14generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_7Lattice_13__iter__(PyObject *__pyx_v_self); /*proto*/
@@ -13091,14 +13369,14 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_13__iter__(PyObject *__pyx_v_self) {
*/
static PyObject *__pyx_pf_5_cdec_7Lattice_12__iter__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_17___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_17___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_18___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_18___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -13108,7 +13386,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_12__iter__(struct __pyx_obj_5_cdec_Lat
__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_7Lattice_14generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Lattice_14generator14, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -13126,9 +13404,9 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_12__iter__(struct __pyx_obj_5_cdec_Lat
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_7Lattice_14generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_7Lattice_14generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
Py_ssize_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -13202,7 +13480,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_16todot(PyObject *__pyx_v_self, CYTHON
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
@@ -13225,24 +13503,24 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CY
*/
static PyObject *__pyx_pf_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lines", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines *)__pyx_ptype_5_cdec___pyx_scope_struct_19_lines->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_19_lines, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)__pyx_ptype_5_cdec___pyx_scope_struct_20_lines->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_20_lines, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
}
__Pyx_GOTREF(__pyx_cur_scope);
- __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *) __Pyx_CyFunction_GetClosure(__pyx_self);
+ __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *) __Pyx_CyFunction_GetClosure(__pyx_self);
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Lattice_5todot_2generator19, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Lattice_5todot_2generator20, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -13260,9 +13538,9 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self) {
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
@@ -13651,7 +13929,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator19(__pyx_GeneratorObj
*/
static PyObject *__pyx_pf_5_cdec_7Lattice_15todot(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *__pyx_cur_scope;
PyObject *__pyx_v_lines = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13662,7 +13940,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_15todot(struct __pyx_obj_5_cdec_Lattic
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("todot", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *)__pyx_ptype_5_cdec___pyx_scope_struct_18_todot->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_18_todot, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)__pyx_ptype_5_cdec___pyx_scope_struct_19_todot->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_19_todot, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -14262,7 +14540,7 @@ static Py_ssize_t __pyx_pf_5_cdec_15SufficientStats_2__len__(struct __pyx_obj_5_
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_15SufficientStats_5__iter__(PyObject *__pyx_v_self); /*proto*/
@@ -14284,14 +14562,14 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_5__iter__(PyObject *__pyx_v_s
*/
static PyObject *__pyx_pf_5_cdec_15SufficientStats_4__iter__(struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_20___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_20___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -14301,7 +14579,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_4__iter__(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_15SufficientStats_6generator14, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_15SufficientStats_6generator15, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -14319,9 +14597,9 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_4__iter__(struct __pyx_obj_5_
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
Py_ssize_t __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
@@ -15012,7 +15290,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self); /*proto*/
@@ -15034,14 +15312,14 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self
*/
static PyObject *__pyx_pf_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_22___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_22___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -15051,7 +15329,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj_5_cde
__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_12CandidateSet_10generator15, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_12CandidateSet_10generator16, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -15069,9 +15347,9 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj_5_cde
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
Py_ssize_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -16509,16 +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_4generator16(__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_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;
}
@@ -16526,20 +16803,71 @@ 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) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config *__pyx_cur_scope;
+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
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_make_config", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config *)__pyx_ptype_5_cdec___pyx_scope_struct_22__make_config->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_22__make_config, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)__pyx_ptype_5_cdec___pyx_scope_struct_23__make_config->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_23__make_config, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -16549,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_4generator16, (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;
@@ -16567,9 +16895,9 @@ static PyObject *__pyx_pf_5_cdec_2_make_config(CYTHON_UNUSED PyObject *__pyx_sel
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_4generator16(__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_22__make_config *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config *)__pyx_generator->closure);
+ 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;
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
@@ -16595,25 +16923,25 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__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;
}
@@ -16624,21 +16952,21 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener
#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 = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[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 = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[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;
}
@@ -16654,7 +16982,7 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__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))) {
@@ -16667,14 +16995,14 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener
__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 = 29; __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 = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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
{
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;
@@ -16682,7 +17010,7 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__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;
@@ -16690,7 +17018,7 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__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);
@@ -16704,7 +17032,7 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__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): # <<<<<<<<<<<<<<
@@ -16717,23 +17045,23 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__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;
}
@@ -16744,21 +17072,21 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener
#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 = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __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 = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __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;
}
@@ -16774,7 +17102,7 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__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))) {
@@ -16787,14 +17115,14 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener
__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 = 31; __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 = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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
{
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;
@@ -16802,7 +17130,7 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__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;
@@ -16810,7 +17138,7 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__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);
@@ -16824,14 +17152,14 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__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);
@@ -16839,10 +17167,10 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__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);
@@ -16876,13 +17204,13 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__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): # <<<<<<<<<<<<<<
@@ -16895,7 +17223,7 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__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: # <<<<<<<<<<<<<<
@@ -16906,7 +17234,7 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__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;
}
@@ -16916,21 +17244,21 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__pyx_GeneratorObject *__pyx_gener
#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;};
+ __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 = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __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;
}
@@ -16942,14 +17270,14 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__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);
@@ -16983,29 +17311,29 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__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);
@@ -17030,7 +17358,7 @@ static PyObject *__pyx_gb_5_cdec_4generator16(__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:;
}
@@ -17067,7 +17395,7 @@ static int __pyx_pw_5_cdec_7Decoder_1__cinit__(PyObject *__pyx_v_self, PyObject
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): # <<<<<<<<<<<<<<
@@ -17092,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)) {
@@ -17105,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);
@@ -17117,9 +17445,9 @@ static int __pyx_pw_5_cdec_7Decoder_1__cinit__(PyObject *__pyx_v_self, PyObject
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+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)) # <<<<<<<<<<<<<<
@@ -17128,24 +17456,24 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator20(__pyx_Generato
*/
static PyObject *__pyx_pf_5_cdec_7Decoder_9__cinit___genexpr(PyObject *__pyx_self) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("genexpr", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr *)__pyx_ptype_5_cdec___pyx_scope_struct_24_genexpr->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_24_genexpr, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)__pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
}
__Pyx_GOTREF(__pyx_cur_scope);
- __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *) __pyx_self;
+ __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ *) __pyx_self;
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Decoder_9__cinit___2generator20, (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;
@@ -17163,9 +17491,9 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_9__cinit___genexpr(PyObject *__pyx_sel
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
@@ -17182,16 +17510,16 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator20(__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;
@@ -17199,7 +17527,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator20(__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;
}
@@ -17210,21 +17538,21 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator20(__pyx_Generato
#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 = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __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 = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __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;
}
@@ -17235,7 +17563,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator20(__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;
@@ -17254,7 +17582,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator20(__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);
@@ -17272,7 +17600,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator20(__pyx_Generato
return NULL;
}
-/* "_cdec.pyx":43
+/* "_cdec.pyx":46
* cdef DenseVector weights
*
* def __cinit__(self, config_str=None, **config): # <<<<<<<<<<<<<<
@@ -17281,7 +17609,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator20(__pyx_Generato
*/
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) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ *__pyx_cur_scope;
PyObject *__pyx_v_formalism = NULL;
std::istringstream *__pyx_v_config_stream;
int __pyx_r;
@@ -17297,7 +17625,7 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *)__pyx_ptype_5_cdec___pyx_scope_struct_23___cinit__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_23___cinit__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ *)__pyx_ptype_5_cdec___pyx_scope_struct_24___cinit__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_24___cinit__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return -1;
@@ -17308,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: # <<<<<<<<<<<<<<
@@ -17318,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', # <<<<<<<<<<<<<<
@@ -17342,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;
@@ -17383,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;
@@ -17437,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) # <<<<<<<<<<<<<<
@@ -17456,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 # <<<<<<<<<<<<<<
@@ -17465,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() # <<<<<<<<<<<<<<
@@ -17490,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 # <<<<<<<<<<<<<<
@@ -17524,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): # <<<<<<<<<<<<<<
@@ -17536,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 # <<<<<<<<<<<<<<
@@ -17559,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): # <<<<<<<<<<<<<<
@@ -17572,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 # <<<<<<<<<<<<<<
@@ -17602,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): # <<<<<<<<<<<<<<
@@ -17629,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): # <<<<<<<<<<<<<<
@@ -17642,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] # <<<<<<<<<<<<<<
@@ -17653,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): # <<<<<<<<<<<<<<
@@ -17666,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() # <<<<<<<<<<<<<<
@@ -17675,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) # <<<<<<<<<<<<<<
@@ -17686,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): # <<<<<<<<<<<<<<
@@ -17699,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() # <<<<<<<<<<<<<<
@@ -17708,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;
}
@@ -17735,21 +18063,21 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
#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 = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __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 = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __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;
}
@@ -17765,7 +18093,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__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))) {
@@ -17778,14 +18106,14 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
__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 = 77; __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 = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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
{
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;
@@ -17793,7 +18121,7 @@ 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;
@@ -17801,7 +18129,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_9 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_fname);
@@ -17811,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:;
@@ -17876,12 +18204,12 @@ 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'].as_str()
+ * 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) {
@@ -17894,24 +18222,24 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_
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'].as_str()
+ * return conf[0]['formalism'].as_str().c_str()
*
*/
__pyx_v_conf = (&__pyx_v_self->dec->GetConf());
- /* "_cdec.pyx":85
+ /* "_cdec.pyx":88
* 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):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __pyx_convert_string_to_py_(((__pyx_v_conf[0])[__pyx_k__formalism]).as<std::string>()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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;
@@ -17940,8 +18268,8 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "_cdec.pyx":87
- * return conf[0]['formalism'].as_str()
+/* "_cdec.pyx":90
+ * return conf[0]['formalism'].as_str().c_str()
*
* def read_weights(self, weights): # <<<<<<<<<<<<<<
* with open(weights) as fp:
@@ -17976,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":88
+ /* "_cdec.pyx":91
*
* def read_weights(self, weights):
* with open(weights) as fp: # <<<<<<<<<<<<<<
@@ -17984,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 = 88; __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 = 88; __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 = 88; __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 = 88; __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 = 88; __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;
@@ -18011,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":89
+ /* "_cdec.pyx":92
* def read_weights(self, weights):
* with open(weights) as fp:
* for line in fp: # <<<<<<<<<<<<<<
@@ -18022,7 +18350,7 @@ 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 = 89; __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;
}
@@ -18032,21 +18360,21 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
#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 = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;};
+ __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 = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;};
+ __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 = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
break;
}
@@ -18056,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":90
+ /* "_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 = 90; __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 = 90; __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 = 90; __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 = 90; __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 = 90; __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;
@@ -18082,16 +18410,16 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
}
__pyx_L18:;
- /* "_cdec.pyx":91
+ /* "_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 = 91; __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 = 91; __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))) {
@@ -18104,7 +18432,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ {__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))) {
@@ -18117,14 +18445,14 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__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 = 91; __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 = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __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
{
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 = 91; __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;
@@ -18132,7 +18460,7 @@ 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 = 91; __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;
@@ -18140,7 +18468,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_13 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__pyx_L20_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_fname);
@@ -18150,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":92
+ /* "_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 = 92; __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 = 92; __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 = 92; __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 = 92; __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 = 92; __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:;
@@ -18183,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":88
+ /* "_cdec.pyx":91
*
* def read_weights(self, weights):
* with open(weights) as fp: # <<<<<<<<<<<<<<
@@ -18192,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 = 88; __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 = 88; __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);
@@ -18209,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 = 88; __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 = 88; __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);
@@ -18221,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 = 88; __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:;
@@ -18249,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 = 88; __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 = 88; __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;
@@ -18295,7 +18623,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sentence,&__pyx_n_s__grammar,0};
PyObject* values[2] = {0,0};
- /* "_cdec.pyx":94
+ /* "_cdec.pyx":97
* self.weights[fname.strip()] = float(value)
*
* def translate(self, sentence, grammar=None): # <<<<<<<<<<<<<<
@@ -18324,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 = 94; __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)) {
@@ -18339,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 = 94; __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();
@@ -18367,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":96
+ /* "_cdec.pyx":99
* def translate(self, sentence, grammar=None):
* cdef bytes input_str
* if isinstance(sentence, unicode) or isinstance(sentence, str): # <<<<<<<<<<<<<<
@@ -18389,19 +18717,19 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
}
if (__pyx_t_4) {
- /* "_cdec.pyx":97
+ /* "_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 = 97; __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 = 97; __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 = 97; __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;
@@ -18409,7 +18737,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
goto __pyx_L3;
}
- /* "_cdec.pyx":98
+ /* "_cdec.pyx":101
* if isinstance(sentence, unicode) or isinstance(sentence, str):
* input_str = as_str(sentence.strip())
* elif isinstance(sentence, Lattice): # <<<<<<<<<<<<<<
@@ -18422,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":99
+ /* "_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 = 99; __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 = 99; __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 = 99; __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":101
+ /* "_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 = 101; __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 = 101; __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 = 101; __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 = 101; __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":102
+ /* "_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 = 102; __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":103
+ /* "_cdec.pyx":106
* raise TypeError('Cannot translate input type %s' % type(sentence))
* if grammar:
* if isinstance(grammar, str) or isinstance(grammar, unicode): # <<<<<<<<<<<<<<
@@ -18499,7 +18827,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
}
if (__pyx_t_3) {
- /* "_cdec.pyx":104
+ /* "_cdec.pyx":107
* if grammar:
* if isinstance(grammar, str) or isinstance(grammar, unicode):
* self.dec.AddSupplementalGrammarFromString(string(as_str(grammar))) # <<<<<<<<<<<<<<
@@ -18511,19 +18839,19 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
}
/*else*/ {
- /* "_cdec.pyx":106
+ /* "_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 = 106; __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 = 106; __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]));
@@ -18534,7 +18862,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
}
__pyx_L4:;
- /* "_cdec.pyx":107
+ /* "_cdec.pyx":110
* else:
* self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0])
* cdef decoder.BasicObserver observer = decoder.BasicObserver() # <<<<<<<<<<<<<<
@@ -18543,17 +18871,17 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
*/
__pyx_v_observer = BasicObserver();
- /* "_cdec.pyx":108
+ /* "_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 = 108; __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":109
+ /* "_cdec.pyx":112
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
* self.dec.Decode(string(input_str), &observer)
* if observer.hypergraph == NULL: # <<<<<<<<<<<<<<
@@ -18563,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":110
+ /* "_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 = 110; __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 = 110; __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 = 110; __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":111
+ /* "_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 = 111; __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":112
+ /* "_cdec.pyx":115
* raise ParseFailed()
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0]) # <<<<<<<<<<<<<<
@@ -18602,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":113
+ /* "_cdec.pyx":116
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
* return hg # <<<<<<<<<<<<<<
@@ -18627,49 +18955,6 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
return __pyx_r;
}
-/* "string.to_py":25
- *
- * @cname("__pyx_convert_string_to_py_")
- * cdef object __pyx_convert_string_to_py_(string& s): # <<<<<<<<<<<<<<
- * return s.data()[:s.size()]
- *
- */
-
-static PyObject *__pyx_convert_string_to_py_(const std::string &__pyx_v_s) {
- 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("__pyx_convert_string_to_py_", 0);
-
- /* "string.to_py":26
- * @cname("__pyx_convert_string_to_py_")
- * cdef object __pyx_convert_string_to_py_(string& s):
- * return s.data()[:s.size()] # <<<<<<<<<<<<<<
- *
- *
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromStringAndSize(__pyx_v_s.data() + 0, __pyx_v_s.size() - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 26; __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("string.to_py.__pyx_convert_string_to_py_", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
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;
@@ -20270,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, 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;
}
@@ -20315,11 +20604,12 @@ static PyMethodDef __pyx_methods_5_cdec_Hypergraph[] = {
{__Pyx_NAMESTR("kbest_trees"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_14kbest_trees, METH_O, __Pyx_DOCSTR(0)},
{__Pyx_NAMESTR("kbest_features"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_17kbest_features, METH_O, __Pyx_DOCSTR(0)},
{__Pyx_NAMESTR("sample"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_20sample, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_23intersect, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("prune"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_25prune, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("lattice"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_27lattice, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("reweight"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_29reweight, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("inside_outside"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_31inside_outside, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("sample_trees"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_23sample_trees, METH_O, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_26intersect, METH_O, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("prune"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_28prune, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("lattice"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_30lattice, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("reweight"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_32reweight, METH_O, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("inside_outside"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_34inside_outside, METH_NOARGS, __Pyx_DOCSTR(0)},
{0, 0, 0, 0}
};
@@ -24863,32 +25153,32 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_11_sample = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_12___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *p;
+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;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o);
p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_12___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o;
Py_XDECREF(((PyObject *)p->__pyx_v_self));
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_12___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_12___get__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
@@ -24896,11 +25186,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_12___get__(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_12___get__[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_12_sample_trees[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_12___get__ = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_12_sample_trees = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -24958,7 +25248,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_12___get__ = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_12___get__ = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_12_sample_trees = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -24971,13 +25261,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_12___get__ = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_12___get__ = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_12_sample_trees = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_12___get__ = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_12_sample_trees = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -24998,12 +25288,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_12___get__ = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12___get__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12_sample_trees = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_12___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_12_sample_trees"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_12___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25013,24 +25303,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12___get__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_12___get__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_12___get__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_12___get__, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_12_sample_trees, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_12_sample_trees, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_12_sample_trees, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer___pyx_scope_struct_12___get__, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_12_sample_trees, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_12___get__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_12___get__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_12___get__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25040,7 +25330,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_12___get__, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25273,7 +25563,7 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_14___get__(PyObject *o) {
struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphEdge *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
@@ -25464,7 +25754,7 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_15___get__(PyObject *o) {
struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphEdge *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
@@ -25818,32 +26108,223 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_16___get__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_17___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *p;
+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;
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o);
+ p->__pyx_v_self = 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o;
+ Py_XDECREF(((PyObject *)p->__pyx_v_self));
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_17___get__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_17___get__[] = {
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_17___get__ = {
+ 0, /*nb_add*/
+ 0, /*nb_subtract*/
+ 0, /*nb_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_divide*/
+ #endif
+ 0, /*nb_remainder*/
+ 0, /*nb_divmod*/
+ 0, /*nb_power*/
+ 0, /*nb_negative*/
+ 0, /*nb_positive*/
+ 0, /*nb_absolute*/
+ 0, /*nb_nonzero*/
+ 0, /*nb_invert*/
+ 0, /*nb_lshift*/
+ 0, /*nb_rshift*/
+ 0, /*nb_and*/
+ 0, /*nb_xor*/
+ 0, /*nb_or*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_coerce*/
+ #endif
+ 0, /*nb_int*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_long*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*nb_float*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_oct*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_hex*/
+ #endif
+ 0, /*nb_inplace_add*/
+ 0, /*nb_inplace_subtract*/
+ 0, /*nb_inplace_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_inplace_divide*/
+ #endif
+ 0, /*nb_inplace_remainder*/
+ 0, /*nb_inplace_power*/
+ 0, /*nb_inplace_lshift*/
+ 0, /*nb_inplace_rshift*/
+ 0, /*nb_inplace_and*/
+ 0, /*nb_inplace_xor*/
+ 0, /*nb_inplace_or*/
+ 0, /*nb_floor_divide*/
+ 0, /*nb_true_divide*/
+ 0, /*nb_inplace_floor_divide*/
+ 0, /*nb_inplace_true_divide*/
+ #if PY_VERSION_HEX >= 0x02050000
+ 0, /*nb_index*/
+ #endif
+};
+
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_17___get__ = {
+ 0, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ 0, /*sq_item*/
+ 0, /*sq_slice*/
+ 0, /*sq_ass_item*/
+ 0, /*sq_ass_slice*/
+ 0, /*sq_contains*/
+ 0, /*sq_inplace_concat*/
+ 0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_17___get__ = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_17___get__ = {
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getreadbuffer*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getwritebuffer*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getsegcount*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getcharbuffer*/
+ #endif
+ #if PY_VERSION_HEX >= 0x02060000
+ 0, /*bf_getbuffer*/
+ #endif
+ #if PY_VERSION_HEX >= 0x02060000
+ 0, /*bf_releasebuffer*/
+ #endif
+};
+
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___get__ = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_17___get__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_17___get__, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*tp_repr*/
+ &__pyx_tp_as_number___pyx_scope_struct_17___get__, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_17___get__, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_17___get__, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_17___get__, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_doc*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_17___get__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_17___get__, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec___pyx_scope_struct_17___get__, /*tp_methods*/
+ 0, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ 0, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_17___get__, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ #if PY_VERSION_HEX >= 0x02060000
+ 0, /*tp_version_tag*/
+ #endif
+};
+
+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;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o);
p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_17___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_18___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o;
Py_XDECREF(((PyObject *)p->__pyx_v_self));
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_17___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_18___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_17___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__ *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_18___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
@@ -25851,11 +26332,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_17___iter__(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_17___iter__[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_18___iter__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_17___iter__ = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_18___iter__ = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -25913,7 +26394,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_17___iter__ = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_17___iter__ = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_18___iter__ = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -25926,13 +26407,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_17___iter__ = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_17___iter__ = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_18___iter__ = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_17___iter__ = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_18___iter__ = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -25953,12 +26434,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_17___iter__ = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___iter__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_17___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_17___iter__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_18___iter__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_17___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_18___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25968,24 +26449,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___iter__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_17___iter__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_17___iter__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_17___iter__, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_18___iter__, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_18___iter__, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_18___iter__, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer___pyx_scope_struct_17___iter__, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_18___iter__, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_17___iter__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_17___iter__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_18___iter__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_18___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_17___iter__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_18___iter__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25995,7 +26476,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_17___iter__, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26009,32 +26490,32 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_18_todot(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *p;
+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;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o);
p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_18_todot(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19_todot(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o;
Py_XDECREF(((PyObject *)p->__pyx_v_self));
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_18_todot(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_19_todot(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_18_todot(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_19_todot(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
@@ -26042,11 +26523,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_18_todot(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_18_todot[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_19_todot[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_18_todot = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_19_todot = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -26104,7 +26585,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_18_todot = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_18_todot = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_19_todot = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -26117,13 +26598,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_18_todot = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_18_todot = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_19_todot = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_18_todot = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_19_todot = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -26144,12 +26625,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_18_todot = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18_todot = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_todot = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_18_todot"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_19_todot"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_18_todot, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19_todot, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26159,24 +26640,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18_todot = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_18_todot, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_18_todot, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_18_todot, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_19_todot, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_19_todot, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_19_todot, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer___pyx_scope_struct_18_todot, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_19_todot, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_18_todot, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_18_todot, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_19_todot, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_19_todot, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_18_todot, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_19_todot, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26186,7 +26667,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18_todot = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_18_todot, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_19_todot, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26200,11 +26681,11 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18_todot = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_19_lines(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines *p;
+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;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o);
p->__pyx_outer_scope = 0;
p->__pyx_v_delta = 0;
p->__pyx_v_i = 0;
@@ -26215,8 +26696,8 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_19_lines(PyTypeObject *t
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19_lines(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20_lines(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o;
Py_XDECREF(((PyObject *)p->__pyx_outer_scope));
Py_XDECREF(p->__pyx_v_delta);
Py_XDECREF(p->__pyx_v_i);
@@ -26227,9 +26708,9 @@ static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19_lines(PyObject *o) {
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_19_lines(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_20_lines(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o;
if (p->__pyx_outer_scope) {
e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
}
@@ -26254,11 +26735,11 @@ static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_19_lines(PyObject *o, vis
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_19_lines(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_20_lines(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_18_todot *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_delta);
p->__pyx_v_delta = Py_None; Py_INCREF(Py_None);
@@ -26281,11 +26762,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_19_lines(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_19_lines[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_20_lines[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_19_lines = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_20_lines = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -26343,7 +26824,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_19_lines = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_19_lines = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_20_lines = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -26356,13 +26837,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_19_lines = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_19_lines = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_20_lines = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_19_lines = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_20_lines = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -26383,12 +26864,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_19_lines = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_lines = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20_lines = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_19_lines"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_19_lines), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_20_lines"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19_lines, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20_lines, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26398,24 +26879,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_lines = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_19_lines, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_19_lines, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_19_lines, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_20_lines, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_20_lines, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_20_lines, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer___pyx_scope_struct_19_lines, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_20_lines, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_19_lines, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_19_lines, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_20_lines, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_20_lines, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_19_lines, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_20_lines, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26425,7 +26906,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_lines = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_19_lines, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_20_lines, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26439,28 +26920,28 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_lines = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_20___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ *p;
+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;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o);
p->__pyx_v_i = 0;
p->__pyx_v_self = 0;
p->__pyx_t_1 = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o;
Py_XDECREF(p->__pyx_v_i);
Py_XDECREF(((PyObject *)p->__pyx_v_self));
Py_XDECREF(p->__pyx_t_1);
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_20___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_21___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o;
if (p->__pyx_v_i) {
e = (*v)(p->__pyx_v_i, a); if (e) return e;
}
@@ -26473,8 +26954,8 @@ static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_20___iter__(PyObject *o,
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_20___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__ *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_i);
p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
@@ -26488,11 +26969,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_20___iter__(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_20___iter__[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_21___iter__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_20___iter__ = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_21___iter__ = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -26550,7 +27031,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_20___iter__ = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_20___iter__ = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_21___iter__ = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -26563,13 +27044,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_20___iter__ = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_20___iter__ = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_21___iter__ = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_20___iter__ = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_21___iter__ = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -26590,12 +27071,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_20___iter__ = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20___iter__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_20___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_20___iter__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_21___iter__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_21___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26605,24 +27086,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20___iter__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_20___iter__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_20___iter__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_20___iter__, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_21___iter__, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_21___iter__, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_21___iter__, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer___pyx_scope_struct_20___iter__, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_21___iter__, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_20___iter__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_20___iter__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_21___iter__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_21___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_20___iter__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_21___iter__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26632,7 +27113,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_20___iter__, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26646,32 +27127,32 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20___iter__ = {
#endif
};
-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;
+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;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o);
p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_22___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o;
Py_XDECREF(((PyObject *)p->__pyx_v_self));
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_21___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_22___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_22___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_5_cdec_CandidateSet *)Py_None); Py_INCREF(Py_None);
@@ -26679,11 +27160,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_21___iter__[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_22___iter__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_21___iter__ = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_22___iter__ = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -26741,7 +27222,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_21___iter__ = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_21___iter__ = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_22___iter__ = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -26754,13 +27235,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_21___iter__ = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_21___iter__ = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_22___iter__ = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_21___iter__ = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_22___iter__ = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -26781,12 +27262,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_21___iter__ = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_22___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_21___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_22___iter__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_21___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_22___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26796,24 +27277,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_21___iter__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_21___iter__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_21___iter__, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_22___iter__, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_22___iter__, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_22___iter__, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer___pyx_scope_struct_21___iter__, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_22___iter__, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_21___iter__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_21___iter__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_22___iter__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_22___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_21___iter__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_22___iter__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26823,7 +27304,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26837,11 +27318,11 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_22__make_config(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config *p;
+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;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)o);
p->__pyx_v_config = 0;
p->__pyx_v_info = 0;
p->__pyx_v_key = 0;
@@ -26852,8 +27333,8 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_22__make_config(PyTypeOb
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_22__make_config(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_23__make_config(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)o;
Py_XDECREF(p->__pyx_v_config);
Py_XDECREF(p->__pyx_v_info);
Py_XDECREF(p->__pyx_v_key);
@@ -26864,9 +27345,9 @@ static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_22__make_config(PyObject
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_22__make_config(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_23__make_config(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)o;
if (p->__pyx_v_config) {
e = (*v)(p->__pyx_v_config, a); if (e) return e;
}
@@ -26891,8 +27372,8 @@ static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_22__make_config(PyObject
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_22__make_config(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_23__make_config(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_config);
p->__pyx_v_config = Py_None; Py_INCREF(Py_None);
@@ -26918,11 +27399,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_22__make_config(PyObject *o)
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_22__make_config[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_23__make_config[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_22__make_config = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_23__make_config = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -26980,7 +27461,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_22__make_config = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_22__make_config = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_23__make_config = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -26993,13 +27474,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_22__make_config
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_22__make_config = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_23__make_config = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_22__make_config = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_23__make_config = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -27020,12 +27501,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_22__make_config = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_22__make_config = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_23__make_config = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_22__make_config"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_22__make_config), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_23__make_config"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_22__make_config, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_23__make_config, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -27035,24 +27516,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_22__make_config = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_22__make_config, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_22__make_config, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_22__make_config, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_23__make_config, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_23__make_config, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_23__make_config, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer___pyx_scope_struct_22__make_config, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_23__make_config, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_22__make_config, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_22__make_config, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_23__make_config, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_23__make_config, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_22__make_config, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_23__make_config, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -27062,7 +27543,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_22__make_config = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_22__make_config, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_23__make_config, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -27076,32 +27557,32 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_22__make_config = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_23___cinit__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *p;
+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;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ *)o);
p->__pyx_v_config = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_23___cinit__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_24___cinit__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ *)o;
Py_XDECREF(p->__pyx_v_config);
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_23___cinit__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_24___cinit__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ *)o;
if (p->__pyx_v_config) {
e = (*v)(p->__pyx_v_config, a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_23___cinit__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_24___cinit__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_v_config);
p->__pyx_v_config = Py_None; Py_INCREF(Py_None);
@@ -27109,11 +27590,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_23___cinit__(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_23___cinit__[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_24___cinit__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_23___cinit__ = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_24___cinit__ = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -27171,7 +27652,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_23___cinit__ = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_23___cinit__ = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_24___cinit__ = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -27184,13 +27665,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_23___cinit__ =
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_23___cinit__ = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_24___cinit__ = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_23___cinit__ = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_24___cinit__ = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -27211,12 +27692,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_23___cinit__ = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_23___cinit__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_24___cinit__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_23___cinit__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_24___cinit__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_23___cinit__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_24___cinit__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -27226,24 +27707,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_23___cinit__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_23___cinit__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_23___cinit__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_23___cinit__, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_24___cinit__, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_24___cinit__, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_24___cinit__, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer___pyx_scope_struct_23___cinit__, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_24___cinit__, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_23___cinit__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_23___cinit__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_24___cinit__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_24___cinit__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_23___cinit__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_24___cinit__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -27253,7 +27734,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_23___cinit__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_23___cinit__, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_24___cinit__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -27267,28 +27748,28 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_23___cinit__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_24_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr *p;
+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;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o);
p->__pyx_outer_scope = 0;
p->__pyx_v_kv = 0;
p->__pyx_t_0 = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_24_genexpr(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o;
Py_XDECREF(((PyObject *)p->__pyx_outer_scope));
Py_XDECREF(p->__pyx_v_kv);
Py_XDECREF(p->__pyx_t_0);
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_24_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o;
if (p->__pyx_outer_scope) {
e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
}
@@ -27301,11 +27782,11 @@ static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_24_genexpr(PyObject *o, v
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_24_genexpr(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_23___cinit__ *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_24___cinit__ *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_kv);
p->__pyx_v_kv = Py_None; Py_INCREF(Py_None);
@@ -27316,11 +27797,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_24_genexpr(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_24_genexpr[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_25_genexpr[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_24_genexpr = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_25_genexpr = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -27378,7 +27859,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_24_genexpr = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_24_genexpr = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_25_genexpr = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -27391,13 +27872,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_24_genexpr = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_24_genexpr = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_25_genexpr = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_24_genexpr = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_25_genexpr = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -27418,12 +27899,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_24_genexpr = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_24_genexpr = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_25_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_24_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_24_genexpr), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_25_genexpr"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_24_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_25_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -27433,24 +27914,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_24_genexpr = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_24_genexpr, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_24_genexpr, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_24_genexpr, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_25_genexpr, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_25_genexpr, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_25_genexpr, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
- &__pyx_tp_as_buffer___pyx_scope_struct_24_genexpr, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_25_genexpr, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_5_cdec___pyx_scope_struct_24_genexpr, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_24_genexpr, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_25_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_25_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_24_genexpr, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_25_genexpr, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -27460,7 +27941,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_24_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_24_genexpr, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_25_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -27608,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},
@@ -27617,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) {
@@ -27627,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 = 102; __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 = 88; __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;
@@ -27695,26 +28178,26 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":191
+ /* "/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 = 191; __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));
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":228
+ /* "/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 = 228; __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));
@@ -27858,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));
@@ -27875,28 +28358,28 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GIVEREF(Py_None);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
- /* "_cdec.pyx":90
+ /* "_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 = 90; __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":88
+ /* "_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 = 88; __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);
@@ -27972,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:;
@@ -28109,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 = 147; __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 = 147; __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 = 147; __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 = 193; __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 = 193; __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 = 193; __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;}
@@ -28145,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__;
@@ -28164,44 +28665,46 @@ 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___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_12___get__ = &__pyx_type_5_cdec___pyx_scope_struct_12___get__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_13___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 119; __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 = 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 = 167; __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 = 203; __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 = 209; __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___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_17___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_17___iter__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_18_todot) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_18_todot = &__pyx_type_5_cdec___pyx_scope_struct_18_todot;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_19_lines) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_19_lines = &__pyx_type_5_cdec___pyx_scope_struct_19_lines;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_20___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_20___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_20___iter__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_21___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __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__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_19_todot) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_19_todot = &__pyx_type_5_cdec___pyx_scope_struct_19_todot;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_20_lines) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_20_lines = &__pyx_type_5_cdec___pyx_scope_struct_20_lines;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_21___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__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__make_config) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_22__make_config = &__pyx_type_5_cdec___pyx_scope_struct_22__make_config;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_23___cinit__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_23___cinit__ = &__pyx_type_5_cdec___pyx_scope_struct_23___cinit__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_24_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_24_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_24_genexpr;
+ 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 = 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 = 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 = 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[7]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_vtabptr_4cdec_2sa_3_sa_Phrase = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_Phrase->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_2sa_3_sa_Rule = __Pyx_ImportType("cdec.sa._sa", "Rule", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Rule), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Rule)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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;}
+ __pyx_vtabptr_4cdec_2sa_3_sa_Phrase = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_Phrase->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_Rule = __Pyx_ImportType("cdec.sa._sa", "Rule", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Rule), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Rule)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Variable import code ---*/
/*--- Function import code ---*/
__pyx_t_1 = __Pyx_ImportModule("cdec.sa._sa"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -28319,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));
@@ -28338,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
@@ -28356,14 +28871,6 @@ PyMODINIT_FUNC PyInit__cdec(void)
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-
- /* "string.to_py":25
- *
- * @cname("__pyx_convert_string_to_py_")
- * cdef object __pyx_convert_string_to_py_(string& s): # <<<<<<<<<<<<<<
- * return s.data()[:s.size()]
- *
- */
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
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