summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/src/_cdec.cpp10705
-rw-r--r--python/src/_cdec.pyx49
-rw-r--r--python/src/decoder.pxd4
-rw-r--r--python/src/hypergraph.pxd52
-rw-r--r--python/src/hypergraph.pxi161
-rw-r--r--python/src/lattice.pxi5
-rw-r--r--python/src/mteval.pxi10
-rw-r--r--python/src/trule.pxi55
-rw-r--r--python/src/utils.pxd12
-rw-r--r--python/test.py20
10 files changed, 9319 insertions, 1754 deletions
diff --git a/python/src/_cdec.cpp b/python/src/_cdec.cpp
index 3a127ba9..e86dcf7b 100644
--- a/python/src/_cdec.cpp
+++ b/python/src/_cdec.cpp
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.16 on Thu Jul 5 16:20:15 2012 */
+/* Generated by Cython 0.16 on Wed Jul 11 16:05:22 2012 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -285,7 +285,9 @@
#include "utils/filelib.h"
#include "utils/sampler.h"
#include <boost/shared_ptr.hpp>
+#include <boost/program_options.hpp>
#include "decoder/lattice.h"
+#include "decoder/trule.h"
#include "decoder/hg.h"
#include "decoder/viterbi.h"
#include "decoder/hg_io.h"
@@ -384,35 +386,51 @@ static const char *__pyx_f[] = {
"vectors.pxi",
"hypergraph.pxi",
"lattice.pxi",
+ "trule.pxi",
"mteval.pxi",
};
/*--- Type declarations ---*/
struct __pyx_obj_5_cdec_Scorer;
+struct __pyx_obj_5_cdec___pyx_scope_struct_20__make_config;
+struct __pyx_obj_5_cdec___pyx_scope_struct_22_genexpr;
+struct __pyx_obj_5_cdec___pyx_scope_struct_9_genexpr;
+struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__;
+struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__;
+struct __pyx_obj_5_cdec___pyx_scope_struct_15___iter__;
+struct __pyx_obj_5_cdec___pyx_scope_struct_7___get__;
struct __pyx_obj_5_cdec_CandidateSet;
-struct __pyx_obj_5_cdec_SufficientStats;
-struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__;
+struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__;
+struct __pyx_obj_5_cdec_TRule;
+struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees;
+struct __pyx_obj_5_cdec_SegmentEvaluator;
struct __pyx_obj_5_cdec___pyx_scope_struct_4_kbest_features;
-struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree;
+struct __pyx_obj_5_cdec___pyx_scope_struct_5_sample;
+struct __pyx_obj_5_cdec_Candidate;
+struct __pyx_obj_5_cdec___pyx_scope_struct_6___get__;
+struct __pyx_obj_5_cdec_HypergraphEdge;
+struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__;
+struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__;
struct __pyx_obj_5_cdec_Decoder;
-struct __pyx_obj_5_cdec_SegmentEvaluator;
+struct __pyx_obj_5_cdec_HypergraphNode;
struct __pyx_obj_5_cdec_SparseVector;
-struct __pyx_obj_5_cdec_Hypergraph;
-struct __pyx_obj_5_cdec_Lattice;
+struct __pyx_obj_5_cdec___pyx_scope_struct_11_genexpr;
+struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__;
struct __pyx_obj_5_cdec___pyx_scope_struct____iter__;
struct __pyx_obj_5_cdec___pyx_scope_struct_2_kbest;
-struct __pyx_obj_5_cdec_Candidate;
-struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines;
-struct __pyx_obj_5_cdec___pyx_scope_struct_5_sample;
struct __pyx_obj_5_cdec_DenseVector;
-struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__;
-struct __pyx_obj_5_cdec___pyx_scope_struct_9___iter__;
-struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__;
-struct __pyx_obj_5_cdec___pyx_scope_struct_7_todot;
+struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines;
+struct __pyx_obj_5_cdec_SufficientStats;
+struct __pyx_obj_5_cdec___pyx_scope_struct_16_todot;
+struct __pyx_obj_5_cdec_Hypergraph;
+struct __pyx_obj_5_cdec_Lattice;
+struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase;
+struct __pyx_obj_5_cdec___pyx_scope_struct_21___cinit__;
+struct __pyx_obj_5_cdec___pyx_scope_struct_19___iter__;
struct __pyx_opt_args_5_cdec_as_str;
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":3
- * cimport mteval
+/* "_cdec.pyx":6
+ * cimport decoder
*
* cdef char* as_str(sentence, error_msg='Cannot convert type %s to str'): # <<<<<<<<<<<<<<
* cdef bytes ret
@@ -423,7 +441,7 @@ struct __pyx_opt_args_5_cdec_as_str {
PyObject *error_msg;
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":122
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":112
* return CandidateSet(self)
*
* cdef class Scorer: # <<<<<<<<<<<<<<
@@ -436,7 +454,124 @@ struct __pyx_obj_5_cdec_Scorer {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":70
+/* "_cdec.pyx":27
+ * class ParseFailed(Exception): pass
+ *
+ * def _make_config(config): # <<<<<<<<<<<<<<
+ * for key, value in config.items():
+ * if isinstance(value, dict):
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_20__make_config {
+ PyObject_HEAD
+ PyObject *__pyx_v_config;
+ PyObject *__pyx_v_info;
+ PyObject *__pyx_v_key;
+ PyObject *__pyx_v_name;
+ PyObject *__pyx_v_value;
+ PyObject *__pyx_t_0;
+ PyObject *__pyx_t_1;
+ Py_ssize_t __pyx_t_2;
+ PyObject *(*__pyx_t_3)(PyObject *);
+ Py_ssize_t __pyx_t_4;
+ PyObject *(*__pyx_t_5)(PyObject *);
+};
+
+
+/* "_cdec.pyx":53
+ * '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_22_genexpr {
+ PyObject_HEAD
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___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/trule.pxi":2
+ * def _phrase(phrase):
+ * return ' '.join('[%s,%d]' % w if isinstance(w, tuple) else w.encode('utf8') for w in phrase) # <<<<<<<<<<<<<<
+ *
+ * cdef class TRule:
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_9_genexpr {
+ PyObject_HEAD
+ struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase *__pyx_outer_scope;
+ PyObject *__pyx_v_w;
+ PyObject *__pyx_t_0;
+ Py_ssize_t __pyx_t_1;
+ PyObject *(*__pyx_t_2)(PyObject *);
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":53
+ * return TDConvert(-self.rule.lhs_)
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores)
+ * return '[%s] ||| %s ||| %s ||| %s' % (self.lhs, _phrase(self.f), _phrase(self.e), scores)
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__ {
+ PyObject_HEAD
+ struct __pyx_obj_5_cdec_TRule *__pyx_v_self;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":189
+ *
+ * property in_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.in_edges_.size()):
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ {
+ PyObject_HEAD
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":49
+ * 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_15___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;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":121
+ *
+ * property nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.nodes_.size()):
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_7___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;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":60
* return result
*
* cdef class CandidateSet: # <<<<<<<<<<<<<<
@@ -451,43 +586,78 @@ struct __pyx_obj_5_cdec_CandidateSet {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":36
- * return fmap
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":195
*
- * cdef class SufficientStats: # <<<<<<<<<<<<<<
- * cdef mteval.SufficientStats* stats
- * cdef mteval.EvaluationMetric* metric
+ * property out_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.out_edges_.size()):
*/
-struct __pyx_obj_5_cdec_SufficientStats {
+struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ {
PyObject_HEAD
- SufficientStats *stats;
- EvaluationMetric *metric;
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":55
- * self.vector.set_value(fid, value)
+/* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":4
+ * return ' '.join('[%s,%d]' % w if isinstance(w, tuple) else w.encode('utf8') for w in phrase)
+ *
+ * cdef class TRule: # <<<<<<<<<<<<<<
+ * cdef hypergraph.TRule* rule
*
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
- * try:
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ {
+struct __pyx_obj_5_cdec_TRule {
PyObject_HEAD
- size_t __pyx_v_i;
- FastSparseVector<weight_t>::const_iterator *__pyx_v_it;
- struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self;
- size_t __pyx_t_0;
- size_t __pyx_t_1;
+ TRule *rule;
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":60
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":43
* del derivations
*
+ * 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
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees {
+ PyObject_HEAD
+ KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal>::Derivation *__pyx_v_e_derivation;
+ KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal> *__pyx_v_e_derivations;
+ PyObject *__pyx_v_e_tree;
+ KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal>::Derivation *__pyx_v_f_derivation;
+ KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal> *__pyx_v_f_derivations;
+ PyObject *__pyx_v_f_tree;
+ unsigned int __pyx_v_k;
+ struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self;
+ PyObject *__pyx_v_size;
+ unsigned int __pyx_t_0;
+ long __pyx_t_1;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":93
+ * self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get())
+ *
+ * cdef class SegmentEvaluator: # <<<<<<<<<<<<<<
+ * cdef shared_ptr[mteval.SegmentEvaluator]* scorer
+ * cdef mteval.EvaluationMetric* metric
+ */
+struct __pyx_obj_5_cdec_SegmentEvaluator {
+ PyObject_HEAD
+ boost::shared_ptr<SegmentEvaluator> *scorer;
+ EvaluationMetric *metric;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":61
+ * del e_derivations
+ *
* def kbest_features(self, size): # <<<<<<<<<<<<<<
- * cdef kb.KBestDerivations[FastSparseVector[weight_t], kb.FeatureVectorTraversal]* derivations = new kb.KBestDerivations[FastSparseVector[weight_t], kb.FeatureVectorTraversal](self.hg[0], size)
- * cdef kb.KBestDerivations[FastSparseVector[weight_t], kb.FeatureVectorTraversal].Derivation* derivation
+ * 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
*/
struct __pyx_obj_5_cdec___pyx_scope_struct_4_kbest_features {
PyObject_HEAD
@@ -502,28 +672,106 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_4_kbest_features {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":46
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":76
* del derivations
*
- * def kbest_tree(self, size): # <<<<<<<<<<<<<<
- * cdef kb.KBestDerivations[vector[WordID], kb.ETreeTraversal]* derivations = new kb.KBestDerivations[vector[WordID], kb.ETreeTraversal](self.hg[0], size)
- * cdef kb.KBestDerivations[vector[WordID], kb.ETreeTraversal].Derivation* derivation
+ * def sample(self, unsigned n): # <<<<<<<<<<<<<<
+ * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
+ * if self.rng == NULL:
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree {
+struct __pyx_obj_5_cdec___pyx_scope_struct_5_sample {
PyObject_HEAD
- KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal>::Derivation *__pyx_v_derivation;
- KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal> *__pyx_v_derivations;
+ std::vector<HypergraphSampler::Hypothesis> *__pyx_v_hypos;
unsigned int __pyx_v_k;
+ unsigned int __pyx_v_n;
struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self;
- PyObject *__pyx_v_size;
- PyObject *__pyx_v_tree;
- unsigned int __pyx_t_0;
- long __pyx_t_1;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "_cdec.pyx":15
- * class ParseFailed(Exception): pass
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":12
+ * return stats
+ *
+ * cdef class Candidate: # <<<<<<<<<<<<<<
+ * cdef mteval.Candidate* candidate
+ * cdef public float score
+ */
+struct __pyx_obj_5_cdec_Candidate {
+ PyObject_HEAD
+ const training::Candidate *candidate;
+ float score;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":115
+ *
+ * property edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.edges_.size()):
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_6___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;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":133
+ * include "trule.pxi"
+ *
+ * cdef class HypergraphEdge: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphEdge* edge
+ */
+struct __pyx_obj_5_cdec_HypergraphEdge {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_5_cdec_HypergraphEdge *__pyx_vtab;
+ Hypergraph *hg;
+ const Hypergraph::Edge *edge;
+ struct __pyx_obj_5_cdec_TRule *trule;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":55
+ * self.vector.set_value(fid, value)
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
+ * try:
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ {
+ PyObject_HEAD
+ size_t __pyx_v_i;
+ FastSparseVector<weight_t>::const_iterator *__pyx_v_it;
+ struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self;
+ size_t __pyx_t_0;
+ size_t __pyx_t_1;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":44
+ * return self.stats.size()
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * for i in range(len(self)):
+ * yield self.stats[0][i]
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ {
+ 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;
+ PyObject *(*__pyx_t_2)(PyObject *);
+};
+
+
+/* "_cdec.pyx":38
+ * yield key, bytes(value)
*
* cdef class Decoder: # <<<<<<<<<<<<<<
* cdef decoder.Decoder* dec
@@ -536,17 +784,18 @@ struct __pyx_obj_5_cdec_Decoder {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":103
- * self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get())
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":179
+ * raise NotImplemented('comparison not implemented for HypergraphEdge')
*
- * cdef class SegmentEvaluator: # <<<<<<<<<<<<<<
- * cdef shared_ptr[mteval.SegmentEvaluator]* scorer
- * cdef mteval.EvaluationMetric* metric
+ * cdef class HypergraphNode: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphNode* node
*/
-struct __pyx_obj_5_cdec_SegmentEvaluator {
+struct __pyx_obj_5_cdec_HypergraphNode {
PyObject_HEAD
- boost::shared_ptr<SegmentEvaluator> *scorer;
- EvaluationMetric *metric;
+ struct __pyx_vtabstruct_5_cdec_HypergraphNode *__pyx_vtab;
+ Hypergraph *hg;
+ const Hypergraph::Node *node;
};
@@ -563,30 +812,35 @@ struct __pyx_obj_5_cdec_SparseVector {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":4
- * cimport kbest as kb
+/* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":54
*
- * cdef class Hypergraph: # <<<<<<<<<<<<<<
- * cdef hypergraph.Hypergraph* hg
- * cdef MT19937* rng
+ * def __str__(self):
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
+ * return '[%s] ||| %s ||| %s ||| %s' % (self.lhs, _phrase(self.f), _phrase(self.e), scores)
*/
-struct __pyx_obj_5_cdec_Hypergraph {
+struct __pyx_obj_5_cdec___pyx_scope_struct_11_genexpr {
PyObject_HEAD
- Hypergraph *hg;
- MT19937 *rng;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__ *__pyx_outer_scope;
+ PyObject *__pyx_v_feat;
+ PyObject *__pyx_t_0;
+ Py_ssize_t __pyx_t_1;
+ PyObject *(*__pyx_t_2)(PyObject *);
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":3
- * cimport lattice
- *
- * cdef class Lattice: # <<<<<<<<<<<<<<
- * cdef lattice.Lattice* lattice
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":153
*
+ * property tail_nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.edge.tail_nodes_.size()):
*/
-struct __pyx_obj_5_cdec_Lattice {
+struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ {
PyObject_HEAD
- Lattice *lattice;
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self;
+ unsigned int __pyx_t_0;
+ unsigned int __pyx_t_1;
};
@@ -606,12 +860,12 @@ struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":32
- * return fmap
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":31
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
*
* def kbest(self, size): # <<<<<<<<<<<<<<
- * cdef kb.KBestDerivations[vector[WordID], kb.ESentenceTraversal]* derivations = new kb.KBestDerivations[vector[WordID], kb.ESentenceTraversal](self.hg[0], size)
- * cdef kb.KBestDerivations[vector[WordID], kb.ESentenceTraversal].Derivation* derivation
+ * 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
*/
struct __pyx_obj_5_cdec___pyx_scope_struct_2_kbest {
PyObject_HEAD
@@ -619,37 +873,35 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_2_kbest {
KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal> *__pyx_v_derivations;
unsigned int __pyx_v_k;
struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self;
- PyObject *__pyx_v_sentence;
PyObject *__pyx_v_size;
unsigned int __pyx_t_0;
long __pyx_t_1;
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":22
- * return stats
+/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":3
+ * from cython.operator cimport preincrement as pinc
+ *
+ * cdef class DenseVector: # <<<<<<<<<<<<<<
+ * cdef vector[weight_t]* vector # Not owned by DenseVector
*
- * cdef class Candidate: # <<<<<<<<<<<<<<
- * cdef mteval.Candidate* candidate
- * cdef public float score
*/
-struct __pyx_obj_5_cdec_Candidate {
+struct __pyx_obj_5_cdec_DenseVector {
PyObject_HEAD
- const training::Candidate *candidate;
- float score;
+ std::vector<weight_t> *vector;
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":59
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
*
* def todot(self):
* def lines(): # <<<<<<<<<<<<<<
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines {
+struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines {
PyObject_HEAD
- struct __pyx_obj_5_cdec___pyx_scope_struct_7_todot *__pyx_outer_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_16_todot *__pyx_outer_scope;
PyObject *__pyx_v_delta;
PyObject *__pyx_v_i;
PyObject *__pyx_v_label;
@@ -663,79 +915,92 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":75
- * del derivations
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":26
+ * return fmap
*
- * def sample(self, unsigned n): # <<<<<<<<<<<<<<
- * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
- * if self.rng == NULL:
+ * cdef class SufficientStats: # <<<<<<<<<<<<<<
+ * cdef mteval.SufficientStats* stats
+ * cdef mteval.EvaluationMetric* metric
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_5_sample {
+struct __pyx_obj_5_cdec_SufficientStats {
PyObject_HEAD
- std::vector<HypergraphSampler::Hypothesis> *__pyx_v_hypos;
- unsigned int __pyx_v_k;
- unsigned int __pyx_v_n;
- struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self;
- PyObject *__pyx_v_sentence;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ SufficientStats *stats;
+ EvaluationMetric *metric;
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":3
- * from cython.operator cimport preincrement as pinc
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":57
+ * del self.lattice
*
- * cdef class DenseVector: # <<<<<<<<<<<<<<
- * cdef vector[weight_t]* vector # Not owned by DenseVector
+ * def todot(self): # <<<<<<<<<<<<<<
+ * def lines():
+ * yield 'digraph lattice {'
+ */
+struct __pyx_obj_5_cdec___pyx_scope_struct_16_todot {
+ PyObject_HEAD
+ struct __pyx_obj_5_cdec_Lattice *__pyx_v_self;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":4
+ * cimport kbest
*
+ * cdef class Hypergraph: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef MT19937* rng
*/
-struct __pyx_obj_5_cdec_DenseVector {
+struct __pyx_obj_5_cdec_Hypergraph {
PyObject_HEAD
- std::vector<weight_t> *vector;
+ Hypergraph *hg;
+ MT19937 *rng;
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":50
- * return hypergraph.AsPLF(self.lattice[0], True).c_str()
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":3
+ * cimport lattice
+ *
+ * cdef class Lattice: # <<<<<<<<<<<<<<
+ * cdef lattice.Lattice* lattice
*
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(len(self)):
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__ {
+struct __pyx_obj_5_cdec_Lattice {
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;
+ Lattice *lattice;
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":54
- * return self.stats.size()
+/* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":1
+ * def _phrase(phrase): # <<<<<<<<<<<<<<
+ * return ' '.join('[%s,%d]' % w if isinstance(w, tuple) else w.encode('utf8') for w in phrase)
*
- * def __iter__(self): # <<<<<<<<<<<<<<
- * for i in range(len(self)):
- * yield self.stats[0][i]
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_9___iter__ {
+struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase {
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;
- PyObject *(*__pyx_t_2)(PyObject *);
+ PyObject *__pyx_v_phrase;
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":95
+/* "_cdec.pyx":42
+ * 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_21___cinit__ {
+ PyObject_HEAD
+ PyObject *__pyx_v_config;
+};
+
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":85
* return candidate
*
* def __iter__(self): # <<<<<<<<<<<<<<
* cdef unsigned i
* for i in range(len(self)):
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__ {
+struct __pyx_obj_5_cdec___pyx_scope_struct_19___iter__ {
PyObject_HEAD
unsigned int __pyx_v_i;
struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self;
@@ -744,18 +1009,33 @@ struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__ {
};
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
- * del self.lattice
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":179
+ * raise NotImplemented('comparison not implemented for HypergraphEdge')
*
- * def todot(self): # <<<<<<<<<<<<<<
- * def lines():
- * yield 'digraph lattice {'
+ * cdef class HypergraphNode: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphNode* node
*/
-struct __pyx_obj_5_cdec___pyx_scope_struct_7_todot {
- PyObject_HEAD
- struct __pyx_obj_5_cdec_Lattice *__pyx_v_self;
+
+struct __pyx_vtabstruct_5_cdec_HypergraphNode {
+ PyObject *(*init)(struct __pyx_obj_5_cdec_HypergraphNode *, Hypergraph *, unsigned int);
};
+static struct __pyx_vtabstruct_5_cdec_HypergraphNode *__pyx_vtabptr_5_cdec_HypergraphNode;
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":133
+ * include "trule.pxi"
+ *
+ * cdef class HypergraphEdge: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphEdge* edge
+ */
+
+struct __pyx_vtabstruct_5_cdec_HypergraphEdge {
+ PyObject *(*init)(struct __pyx_obj_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int);
+};
+static struct __pyx_vtabstruct_5_cdec_HypergraphEdge *__pyx_vtabptr_5_cdec_HypergraphEdge;
#ifndef CYTHON_REFNANNY
#define CYTHON_REFNANNY 0
#endif
@@ -838,6 +1118,27 @@ static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}
+static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
+
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
+ if (likely(PyList_CheckExact(L))) {
+ if (PyList_Append(L, x) < 0) return NULL;
+ Py_INCREF(Py_None);
+ return Py_None; /* this is just to have an accurate signature */
+ }
+ else {
+ PyObject *r, *m;
+ m = __Pyx_GetAttrString(L, "append");
+ if (!m) return NULL;
+ r = PyObject_CallFunctionObjArgs(m, x, NULL);
+ Py_DECREF(m);
+ return r;
+ }
+}
+
+#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL);
+static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); /*proto*/
+
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
@@ -916,8 +1217,6 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i)
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}
-static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
-
static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
#define __Pyx_PyObject_AsDouble(obj) \
((likely(PyFloat_CheckExact(obj))) ? \
@@ -977,6 +1276,18 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
PyObject *tuple);
static int __Pyx_CyFunction_init(void);
+#include <string.h>
+
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
+
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
+
+#if PY_MAJOR_VERSION >= 3
+#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
+#else
+#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
+#endif
+
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
@@ -1009,6 +1320,9 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+ int lineno, const char *filename); /*proto*/
+
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
#define __Pyx_Generator_USED
@@ -1030,11 +1344,10 @@ static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
PyObject *closure);
static int __pyx_Generator_init(void);
-static void __Pyx_WriteUnraisable(const char *name, int clineno,
- int lineno, const char *filename); /*proto*/
-
static int __Pyx_check_binary_version(void);
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+
typedef struct {
int code_line;
PyCodeObject* code_object;
@@ -1079,6 +1392,9 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
static PyTypeObject *__pyx_ptype_5_cdec_DenseVector = 0;
static PyTypeObject *__pyx_ptype_5_cdec_SparseVector = 0;
static PyTypeObject *__pyx_ptype_5_cdec_Hypergraph = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_TRule = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_HypergraphEdge = 0;
+static PyTypeObject *__pyx_ptype_5_cdec_HypergraphNode = 0;
static PyTypeObject *__pyx_ptype_5_cdec_Lattice = 0;
static PyTypeObject *__pyx_ptype_5_cdec_Candidate = 0;
static PyTypeObject *__pyx_ptype_5_cdec_SufficientStats = 0;
@@ -1089,14 +1405,26 @@ static PyTypeObject *__pyx_ptype_5_cdec_Decoder = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct____iter__ = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_1___iter__ = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_2_kbest = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_3_kbest_tree = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_3_kbest_trees = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_4_kbest_features = 0;
static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_5_sample = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_6___iter__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_7_todot = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_8_lines = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_9___iter__ = 0;
-static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_10___iter__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_6___get__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_7___get__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_8__phrase = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_9_genexpr = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_10___str__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_11_genexpr = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_12___get__ = 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___iter__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_16_todot = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_17_lines = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_18___iter__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_19___iter__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_20__make_config = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_21___cinit__ = 0;
+static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_22_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_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject *, PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "_cdec"
@@ -1104,9 +1432,9 @@ int __pyx_module_is_main__cdec = 0;
/* Implementation of '_cdec' */
static PyObject *__pyx_builtin_Exception;
+static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_range;
-static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_eval;
static PyObject *__pyx_builtin_enumerate;
@@ -1142,17 +1470,44 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__div__(PyObject *__pyx_v_x, P
#endif
static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_tree(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_source_tree(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_features(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_joshua(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_10Hypergraph_10kbest(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size); /* proto */
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_13kbest_tree(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size); /* proto */
+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_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_7_phrase_genexpr(PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_phrase); /* proto */
+static PyObject *__pyx_pf_5_cdec_5TRule_5arity___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_5TRule___str__(struct __pyx_obj_5_cdec_TRule *__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 */
+static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
+static PyObject *__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); /* proto */
+static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_5trule___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
+static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_2__set__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self); /* proto */
+static PyObject *__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); /* proto */
static int __pyx_pf_5_cdec_7Lattice___init__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index); /* proto */
static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_arcs); /* proto */
@@ -1186,45 +1541,70 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p
static void __pyx_pf_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Scorer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Scorer *__pyx_v_self, PyObject *__pyx_v_refs); /* proto */
static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer *__pyx_v_self); /* proto */
-static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, char *__pyx_v_config); /* 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_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 */
static PyObject *__pyx_pf_5_cdec_7Decoder_7weights___get__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self); /* proto */
static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */
-static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_cfg); /* proto */
+static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */
static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_sentence, PyObject *__pyx_v_grammar); /* proto */
-static char __pyx_k_1[] = "cannot take the dot product of %s and SparseVector";
-static char __pyx_k_2[] = "comparison not implemented for SparseVector";
-static char __pyx_k_10[] = "csplit_preserve_full_word";
-static char __pyx_k_11[] = "cannot reweight hypergraph with %s";
-static char __pyx_k_13[] = "Cannot create lattice from %s";
-static char __pyx_k_14[] = "lattice index out of range";
-static char __pyx_k_19[] = "digraph lattice {";
- static char __pyx_k_20[] = "rankdir = LR;";
- static char __pyx_k_21[] = "node [shape=circle];";
- static char __pyx_k_22[] = "%d -> %d [label=\"%s\"];";
- static char __pyx_k_23[] = "\"";
- static char __pyx_k_24[] = "\\\"";
- static char __pyx_k_26[] = "%d [shape=doublecircle]";
-static char __pyx_k_27[] = "}";
-static char __pyx_k_30[] = "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi";
-static char __pyx_k_31[] = "\n";
-static char __pyx_k_33[] = "Cannot convert type %s to str";
-static char __pyx_k_35[] = "candidate set index out of range";
-static char __pyx_k_37[] = "cannot initialize weights with %s";
-static char __pyx_k_40[] = "Cannot translate input type %s";
+static char __pyx_k_1[] = "Cannot convert type %s to str";
+static char __pyx_k_3[] = "cannot take the dot product of %s and SparseVector";
+static char __pyx_k_4[] = "comparison not implemented for SparseVector";
+static char __pyx_k_6[] = "csplit_preserve_full_word";
+static char __pyx_k_7[] = "cannot reweight hypergraph with %s";
+static char __pyx_k_8[] = "[%s,%d]";
+static char __pyx_k_10[] = " ";
+static char __pyx_k_11[] = "%s=%s";
+static char __pyx_k_12[] = "[%s] ||| %s ||| %s ||| %s";
+static char __pyx_k_13[] = "comparison not implemented for HypergraphEdge";
+static char __pyx_k_15[] = "comparison not implemented for HypergraphNode";
+static char __pyx_k_18[] = "Cannot create lattice from %s";
+static char __pyx_k_19[] = "lattice index out of range";
+static char __pyx_k_23[] = "digraph lattice {";
+ static char __pyx_k_24[] = "rankdir = LR;";
+ static char __pyx_k_25[] = "node [shape=circle];";
+ static char __pyx_k_26[] = "%d -> %d [label=\"%s\"];";
+ static char __pyx_k_27[] = "\"";
+ static char __pyx_k_28[] = "\\\"";
+ static char __pyx_k_30[] = "%d [shape=doublecircle]";
+static char __pyx_k_31[] = "}";
+static char __pyx_k_34[] = "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi";
+static char __pyx_k_35[] = "\n";
+static char __pyx_k_37[] = "candidate set index out of range";
+static char __pyx_k_39[] = "%s %s";
+static char __pyx_k_40[] = "%s = %s";
+static char __pyx_k_42[] = "formalism \"%s\" unknown";
+static char __pyx_k_43[] = "cannot initialize weights with %s";
+static char __pyx_k_44[] = "#";
+static char __pyx_k_48[] = "Cannot translate input type %s";
+static char __pyx_k_51[] = "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi";
+static char __pyx_k_56[] = "/Users/vchahun/Sandbox/cdec/python/src/_cdec.pyx";
+static char __pyx_k__e[] = "e";
+static char __pyx_k__f[] = "f";
static char __pyx_k__i[] = "i";
static char __pyx_k__k[] = "k";
+static char __pyx_k__pb[] = "pb";
static char __pyx_k__TER[] = "TER";
static char __pyx_k__dot[] = "dot";
+static char __pyx_k__fst[] = "fst";
+static char __pyx_k__get[] = "get";
static char __pyx_k__inp[] = "inp";
+static char __pyx_k__key[] = "key";
+static char __pyx_k__lhs[] = "lhs";
static char __pyx_k__plf[] = "plf";
static char __pyx_k__BLEU[] = "BLEU";
static char __pyx_k__eval[] = "eval";
+static char __pyx_k__info[] = "info";
static char __pyx_k__join[] = "join";
static char __pyx_k__name[] = "name";
static char __pyx_k__open[] = "open";
static char __pyx_k__refs[] = "refs";
+static char __pyx_k__scfg[] = "scfg";
static char __pyx_k__self[] = "self";
+static char __pyx_k__span[] = "span";
static char __pyx_k__utf8[] = "utf8";
static char __pyx_k___cdec[] = "_cdec";
static char __pyx_k__delta[] = "delta";
@@ -1234,11 +1614,17 @@ static char __pyx_k__lines[] = "lines";
static char __pyx_k__range[] = "range";
static char __pyx_k__split[] = "split";
static char __pyx_k__strip[] = "strip";
+static char __pyx_k__value[] = "value";
static char __pyx_k__config[] = "config";
-static char __pyx_k__decode[] = "decode";
+static char __pyx_k__csplit[] = "csplit";
static char __pyx_k__encode[] = "encode";
+static char __pyx_k__phrase[] = "phrase";
+static char __pyx_k__scores[] = "scores";
+static char __pyx_k__tagger[] = "tagger";
static char __pyx_k__weight[] = "weight";
+static char __pyx_k___phrase[] = "_phrase";
static char __pyx_k__density[] = "density";
+static char __pyx_k__genexpr[] = "genexpr";
static char __pyx_k__grammar[] = "grammar";
static char __pyx_k__replace[] = "replace";
static char __pyx_k__IBM_BLEU[] = "IBM_BLEU";
@@ -1247,41 +1633,62 @@ static char __pyx_k____exit__[] = "__exit__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__encoding[] = "encoding";
+static char __pyx_k__in_edges[] = "in_edges";
+static char __pyx_k__lexalign[] = "lexalign";
+static char __pyx_k__lextrans[] = "lextrans";
static char __pyx_k__sentence[] = "sentence";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k__TypeError[] = "TypeError";
static char __pyx_k____enter__[] = "__enter__";
static char __pyx_k__enumerate[] = "enumerate";
static char __pyx_k__evaluator[] = "evaluator";
+static char __pyx_k__formalism[] = "formalism";
static char __pyx_k__IndexError[] = "IndexError";
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__startswith[] = "startswith";
static char __pyx_k__ParseFailed[] = "ParseFailed";
+static char __pyx_k___make_config[] = "_make_config";
+static char __pyx_k__InvalidConfig[] = "InvalidConfig";
static char __pyx_k__NotImplemented[] = "NotImplemented";
static PyObject *__pyx_kp_s_1;
-static PyObject *__pyx_n_s_10;
+static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_s_11;
+static PyObject *__pyx_kp_s_12;
static PyObject *__pyx_kp_s_13;
-static PyObject *__pyx_kp_s_14;
+static PyObject *__pyx_kp_s_15;
+static PyObject *__pyx_kp_s_18;
static PyObject *__pyx_kp_s_19;
-static PyObject *__pyx_kp_s_2;
-static PyObject *__pyx_kp_s_20;
-static PyObject *__pyx_kp_s_21;
-static PyObject *__pyx_kp_s_22;
static PyObject *__pyx_kp_s_23;
static PyObject *__pyx_kp_s_24;
+static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_kp_s_26;
static PyObject *__pyx_kp_s_27;
+static PyObject *__pyx_kp_s_28;
+static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_30;
static PyObject *__pyx_kp_s_31;
-static PyObject *__pyx_kp_s_33;
+static PyObject *__pyx_kp_s_34;
static PyObject *__pyx_kp_s_35;
static PyObject *__pyx_kp_s_37;
+static PyObject *__pyx_kp_s_39;
+static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_s_40;
+static PyObject *__pyx_kp_s_42;
+static PyObject *__pyx_kp_s_43;
+static PyObject *__pyx_kp_s_44;
+static PyObject *__pyx_kp_s_48;
+static PyObject *__pyx_kp_s_51;
+static PyObject *__pyx_kp_s_56;
+static PyObject *__pyx_n_s_6;
+static PyObject *__pyx_kp_s_7;
+static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_n_s__BLEU;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__IBM_BLEU;
static PyObject *__pyx_n_s__IndexError;
+static PyObject *__pyx_n_s__InvalidConfig;
static PyObject *__pyx_n_s__KeyError;
static PyObject *__pyx_n_s__NotImplemented;
static PyObject *__pyx_n_s__ParseFailed;
@@ -1292,62 +1699,219 @@ static PyObject *__pyx_n_s____exit__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s___cdec;
+static PyObject *__pyx_n_s___make_config;
+static PyObject *__pyx_n_s___phrase;
static PyObject *__pyx_n_s__beam_alpha;
static PyObject *__pyx_n_s__config;
-static PyObject *__pyx_n_s__decode;
+static PyObject *__pyx_n_s__config_str;
+static PyObject *__pyx_n_s__csplit;
static PyObject *__pyx_n_s__delta;
static PyObject *__pyx_n_s__density;
static PyObject *__pyx_n_s__dot;
+static PyObject *__pyx_n_s__e;
static PyObject *__pyx_n_s__encode;
static PyObject *__pyx_n_s__encoding;
static PyObject *__pyx_n_s__enumerate;
static PyObject *__pyx_n_s__eval;
static PyObject *__pyx_n_s__evaluator;
+static PyObject *__pyx_n_s__f;
+static PyObject *__pyx_n_s__formalism;
+static PyObject *__pyx_n_s__fst;
+static PyObject *__pyx_n_s__genexpr;
+static PyObject *__pyx_n_s__get;
static PyObject *__pyx_n_s__grammar;
static PyObject *__pyx_n_s__hypergraph;
static PyObject *__pyx_n_s__i;
+static PyObject *__pyx_n_s__in_edges;
+static PyObject *__pyx_n_s__info;
static PyObject *__pyx_n_s__inp;
static PyObject *__pyx_n_s__items;
static PyObject *__pyx_n_s__join;
static PyObject *__pyx_n_s__k;
+static PyObject *__pyx_n_s__key;
static PyObject *__pyx_n_s__label;
+static PyObject *__pyx_n_s__lexalign;
+static PyObject *__pyx_n_s__lextrans;
+static PyObject *__pyx_n_s__lhs;
static PyObject *__pyx_n_s__lines;
static PyObject *__pyx_n_s__name;
static PyObject *__pyx_n_s__open;
+static PyObject *__pyx_n_s__pb;
+static PyObject *__pyx_n_s__phrase;
static PyObject *__pyx_n_s__plf;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__refs;
static PyObject *__pyx_n_s__replace;
+static PyObject *__pyx_n_s__scfg;
+static PyObject *__pyx_n_s__scores;
static PyObject *__pyx_n_s__self;
static PyObject *__pyx_n_s__sentence;
+static PyObject *__pyx_n_s__span;
static PyObject *__pyx_n_s__split;
+static PyObject *__pyx_n_s__startswith;
static PyObject *__pyx_n_s__strip;
+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_int_0;
static PyObject *__pyx_int_1;
-static PyObject *__pyx_k_tuple_3;
-static PyObject *__pyx_k_tuple_4;
+static PyObject *__pyx_k_tuple_2;
static PyObject *__pyx_k_tuple_5;
-static PyObject *__pyx_k_tuple_6;
-static PyObject *__pyx_k_tuple_7;
-static PyObject *__pyx_k_tuple_8;
static PyObject *__pyx_k_tuple_9;
-static PyObject *__pyx_k_tuple_12;
-static PyObject *__pyx_k_tuple_15;
+static PyObject *__pyx_k_tuple_14;
static PyObject *__pyx_k_tuple_16;
static PyObject *__pyx_k_tuple_17;
-static PyObject *__pyx_k_tuple_18;
-static PyObject *__pyx_k_tuple_25;
-static PyObject *__pyx_k_tuple_28;
+static PyObject *__pyx_k_tuple_20;
+static PyObject *__pyx_k_tuple_21;
+static PyObject *__pyx_k_tuple_22;
+static PyObject *__pyx_k_tuple_29;
static PyObject *__pyx_k_tuple_32;
-static PyObject *__pyx_k_tuple_34;
static PyObject *__pyx_k_tuple_36;
static PyObject *__pyx_k_tuple_38;
-static PyObject *__pyx_k_tuple_39;
static PyObject *__pyx_k_tuple_41;
-static PyObject *__pyx_k_tuple_42;
-static PyObject *__pyx_k_codeobj_29;
+static PyObject *__pyx_k_tuple_45;
+static PyObject *__pyx_k_tuple_46;
+static PyObject *__pyx_k_tuple_47;
+static PyObject *__pyx_k_tuple_49;
+static PyObject *__pyx_k_tuple_52;
+static PyObject *__pyx_k_tuple_53;
+static PyObject *__pyx_k_tuple_54;
+static PyObject *__pyx_k_codeobj_33;
+static PyObject *__pyx_k_codeobj_50;
+static PyObject *__pyx_k_codeobj_55;
+
+/* "_cdec.pyx":6
+ * cimport decoder
+ *
+ * cdef char* as_str(sentence, error_msg='Cannot convert type %s to str'): # <<<<<<<<<<<<<<
+ * cdef bytes ret
+ * if isinstance(sentence, unicode):
+ */
+
+static char *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_sentence, struct __pyx_opt_args_5_cdec_as_str *__pyx_optional_args) {
+ PyObject *__pyx_v_error_msg = ((PyObject *)__pyx_kp_s_1);
+ PyObject *__pyx_v_ret = 0;
+ char *__pyx_r;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ char *__pyx_t_4;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("as_str", 0);
+ if (__pyx_optional_args) {
+ if (__pyx_optional_args->__pyx_n > 0) {
+ __pyx_v_error_msg = __pyx_optional_args->error_msg;
+ }
+ }
+
+ /* "_cdec.pyx":8
+ * cdef char* as_str(sentence, error_msg='Cannot convert type %s to str'):
+ * cdef bytes ret
+ * if isinstance(sentence, unicode): # <<<<<<<<<<<<<<
+ * ret = sentence.encode('utf8')
+ * elif isinstance(sentence, str):
+ */
+ __pyx_t_1 = ((PyObject *)((PyObject*)(&PyUnicode_Type)));
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_sentence, __pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_2) {
+
+ /* "_cdec.pyx":9
+ * cdef bytes ret
+ * if isinstance(sentence, unicode):
+ * ret = sentence.encode('utf8') # <<<<<<<<<<<<<<
+ * elif isinstance(sentence, str):
+ * ret = sentence
+ */
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_ret = ((PyObject*)__pyx_t_3);
+ __pyx_t_3 = 0;
+ goto __pyx_L3;
+ }
+
+ /* "_cdec.pyx":10
+ * if isinstance(sentence, unicode):
+ * ret = sentence.encode('utf8')
+ * elif isinstance(sentence, str): # <<<<<<<<<<<<<<
+ * ret = sentence
+ * else:
+ */
+ __pyx_t_3 = ((PyObject *)((PyObject*)(&PyString_Type)));
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_sentence, __pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (__pyx_t_2) {
+
+ /* "_cdec.pyx":11
+ * ret = sentence.encode('utf8')
+ * elif isinstance(sentence, str):
+ * ret = sentence # <<<<<<<<<<<<<<
+ * else:
+ * raise TypeError(error_msg % type(sentence))
+ */
+ if (!(likely(PyBytes_CheckExact(__pyx_v_sentence))||((__pyx_v_sentence) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_sentence)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(__pyx_v_sentence);
+ __pyx_v_ret = ((PyObject*)__pyx_v_sentence);
+ goto __pyx_L3;
+ }
+ /*else*/ {
+
+ /* "_cdec.pyx":13
+ * ret = sentence
+ * else:
+ * raise TypeError(error_msg % type(sentence)) # <<<<<<<<<<<<<<
+ * return ret
+ *
+ */
+ __pyx_t_3 = PyNumber_Remainder(__pyx_v_error_msg, ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_L3:;
+
+ /* "_cdec.pyx":14
+ * else:
+ * raise TypeError(error_msg % type(sentence))
+ * return ret # <<<<<<<<<<<<<<
+ *
+ * include "vectors.pxi"
+ */
+ __pyx_t_4 = PyBytes_AsString(((PyObject *)__pyx_v_ret)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_r = __pyx_t_4;
+ goto __pyx_L0;
+
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_WriteUnraisable("_cdec.as_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_ret);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
/* Python wrapper */
static Py_ssize_t __pyx_pw_5_cdec_11DenseVector_1__len__(PyObject *__pyx_v_self); /*proto*/
@@ -2503,7 +3067,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_11dot(struct __pyx_obj_5_cdec_Sp
*
* def __richcmp__(SparseVector x, SparseVector y, int op):
*/
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __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[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
@@ -2634,7 +3198,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13__richcmp__(struct __pyx_obj_5
*
* def __len__(self):
*/
- __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __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;
@@ -3548,7 +4112,6 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_self, C
static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
std::vector<WordID> __pyx_v_trans;
- PyObject *__pyx_v_sentence = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -3562,39 +4125,34 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H
* def viterbi(self):
* cdef vector[WordID] trans
* hypergraph.ViterbiESentence(self.hg[0], &trans) # <<<<<<<<<<<<<<
- * cdef str sentence = GetString(trans).c_str()
- * return sentence.decode('utf8')
+ * return unicode(GetString(trans).c_str(), 'utf8')
+ *
*/
ViterbiESentence((__pyx_v_self->hg[0]), (&__pyx_v_trans));
/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":16
* cdef vector[WordID] trans
* hypergraph.ViterbiESentence(self.hg[0], &trans)
- * cdef str sentence = GetString(trans).c_str() # <<<<<<<<<<<<<<
- * return sentence.decode('utf8')
+ * return unicode(GetString(trans).c_str(), 'utf8') # <<<<<<<<<<<<<<
*
+ * 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[2]; __pyx_lineno = 16; __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[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_sentence = ((PyObject*)__pyx_t_1);
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __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));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__utf8));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__pyx_t_1 = 0;
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":17
- * hypergraph.ViterbiESentence(self.hg[0], &trans)
- * cdef str sentence = GetString(trans).c_str()
- * return sentence.decode('utf8') # <<<<<<<<<<<<<<
- *
- * def viterbi_tree(self):
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_sentence), __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; __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[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; __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;
- __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -3605,33 +4163,33 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H
__Pyx_AddTraceback("_cdec.Hypergraph.viterbi", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
- __Pyx_XDECREF(__pyx_v_sentence);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_5viterbi_tree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_5viterbi_tree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("viterbi_tree (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_10Hypergraph_4viterbi_tree(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
+ __Pyx_RefNannySetupContext("viterbi_trees (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":19
- * return sentence.decode('utf8')
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":18
+ * return unicode(GetString(trans).c_str(), 'utf8')
*
- * def viterbi_tree(self): # <<<<<<<<<<<<<<
- * cdef str tree = hypergraph.ViterbiETree(self.hg[0]).c_str()
- * return tree.decode('utf8')
+ * 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')
*/
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_tree(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
- PyObject *__pyx_v_tree = 0;
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
+ PyObject *__pyx_v_f_tree = NULL;
+ PyObject *__pyx_v_e_tree = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -3639,36 +4197,72 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_tree(struct __pyx_obj_5_c
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("viterbi_tree", 0);
+ __Pyx_RefNannySetupContext("viterbi_trees", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":20
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":19
*
- * def viterbi_tree(self):
- * cdef str tree = hypergraph.ViterbiETree(self.hg[0]).c_str() # <<<<<<<<<<<<<<
- * return tree.decode('utf8')
+ * 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[2]; __pyx_lineno = 19; __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[2]; __pyx_lineno = 19; __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));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
+ 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[2]; __pyx_lineno = 19; __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
+ * 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[2]; __pyx_lineno = 20; __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[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_tree = ((PyObject*)__pyx_t_1);
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __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));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
+ 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[2]; __pyx_lineno = 20; __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
- * def viterbi_tree(self):
- * cdef str tree = hypergraph.ViterbiETree(self.hg[0]).c_str()
- * return tree.decode('utf8') # <<<<<<<<<<<<<<
+ * 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) # <<<<<<<<<<<<<<
*
- * def viterbi_source_tree(self):
+ * def viterbi_features(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tree), __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __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[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __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;
- __pyx_t_2 = 0;
+ __Pyx_INCREF(((PyObject *)__pyx_v_f_tree));
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f_tree));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_f_tree));
+ __Pyx_INCREF(((PyObject *)__pyx_v_e_tree));
+ PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_e_tree));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_e_tree));
+ __pyx_r = ((PyObject *)__pyx_t_1);
+ __pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -3676,159 +4270,153 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_tree(struct __pyx_obj_5_c
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_AddTraceback("_cdec.Hypergraph.viterbi_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("_cdec.Hypergraph.viterbi_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
- __Pyx_XDECREF(__pyx_v_tree);
+ __Pyx_XDECREF(__pyx_v_f_tree);
+ __Pyx_XDECREF(__pyx_v_e_tree);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_7viterbi_source_tree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_7viterbi_source_tree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_7viterbi_features(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_7viterbi_features(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("viterbi_source_tree (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_10Hypergraph_6viterbi_source_tree(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
+ __Pyx_RefNannySetupContext("viterbi_features (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_6viterbi_features(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":23
- * return tree.decode('utf8')
+ * return (f_tree, e_tree)
*
- * def viterbi_source_tree(self): # <<<<<<<<<<<<<<
- * cdef str tree = hypergraph.ViterbiFTree(self.hg[0]).c_str()
- * return tree.decode('utf8')
+ * def viterbi_features(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector fmap = SparseVector()
+ * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
*/
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_source_tree(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
- PyObject *__pyx_v_tree = 0;
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
+ struct __pyx_obj_5_cdec_SparseVector *__pyx_v_fmap = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("viterbi_source_tree", 0);
+ __Pyx_RefNannySetupContext("viterbi_features", 0);
/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":24
*
- * def viterbi_source_tree(self):
- * cdef str tree = hypergraph.ViterbiFTree(self.hg[0]).c_str() # <<<<<<<<<<<<<<
- * return tree.decode('utf8')
- *
+ * def viterbi_features(self):
+ * cdef SparseVector fmap = SparseVector() # <<<<<<<<<<<<<<
+ * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
+ * return fmap
*/
- __pyx_t_1 = PyBytes_FromString(ViterbiFTree((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __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[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_tree = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __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
- * def viterbi_source_tree(self):
- * cdef str tree = hypergraph.ViterbiFTree(self.hg[0]).c_str()
- * return tree.decode('utf8') # <<<<<<<<<<<<<<
- *
* def viterbi_features(self):
+ * cdef SparseVector fmap = SparseVector()
+ * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) # <<<<<<<<<<<<<<
+ * return fmap
+ *
+ */
+ __pyx_v_fmap->vector = new FastSparseVector<weight_t>(ViterbiFeatures((__pyx_v_self->hg[0])));
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":26
+ * cdef SparseVector fmap = SparseVector()
+ * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
+ * return fmap # <<<<<<<<<<<<<<
+ *
+ * def viterbi_joshua(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tree), __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __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;
- __pyx_t_2 = 0;
+ __Pyx_INCREF(((PyObject *)__pyx_v_fmap));
+ __pyx_r = ((PyObject *)__pyx_v_fmap);
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_2);
- __Pyx_AddTraceback("_cdec.Hypergraph.viterbi_source_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("_cdec.Hypergraph.viterbi_features", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
- __Pyx_XDECREF(__pyx_v_tree);
+ __Pyx_XDECREF((PyObject *)__pyx_v_fmap);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_9viterbi_features(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_9viterbi_features(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_9viterbi_joshua(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_9viterbi_joshua(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("viterbi_features (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_10Hypergraph_8viterbi_features(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
+ __Pyx_RefNannySetupContext("viterbi_joshua (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_8viterbi_joshua(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":27
- * return tree.decode('utf8')
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":28
+ * return fmap
+ *
+ * def viterbi_joshua(self): # <<<<<<<<<<<<<<
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
*
- * def viterbi_features(self): # <<<<<<<<<<<<<<
- * cdef SparseVector fmap = SparseVector()
- * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
*/
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_features(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
- struct __pyx_obj_5_cdec_SparseVector *__pyx_v_fmap = 0;
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_joshua(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("viterbi_features", 0);
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":28
- *
- * def viterbi_features(self):
- * cdef SparseVector fmap = SparseVector() # <<<<<<<<<<<<<<
- * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
- * return fmap
- */
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
- __pyx_t_1 = 0;
+ __Pyx_RefNannySetupContext("viterbi_joshua", 0);
/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":29
- * def viterbi_features(self):
- * cdef SparseVector fmap = SparseVector()
- * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) # <<<<<<<<<<<<<<
- * return fmap
*
- */
- __pyx_v_fmap->vector = new FastSparseVector<weight_t>(ViterbiFeatures((__pyx_v_self->hg[0])));
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":30
- * cdef SparseVector fmap = SparseVector()
- * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
- * return fmap # <<<<<<<<<<<<<<
+ * def viterbi_joshua(self):
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<<
*
* def kbest(self, size):
*/
__Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(((PyObject *)__pyx_v_fmap));
- __pyx_r = ((PyObject *)__pyx_v_fmap);
+ __pyx_t_1 = PyBytes_FromString(JoshuaVisualizationString((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __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[2]; __pyx_lineno = 29; __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));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
+ 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[2]; __pyx_lineno = 29; __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;
+ __pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_AddTraceback("_cdec.Hypergraph.viterbi_features", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_cdec.Hypergraph.viterbi_joshua", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
- __Pyx_XDECREF((PyObject *)__pyx_v_fmap);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -3846,12 +4434,12 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_11kbest(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":32
- * return fmap
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":31
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
*
* def kbest(self, size): # <<<<<<<<<<<<<<
- * cdef kb.KBestDerivations[vector[WordID], kb.ESentenceTraversal]* derivations = new kb.KBestDerivations[vector[WordID], kb.ESentenceTraversal](self.hg[0], size)
- * cdef kb.KBestDerivations[vector[WordID], kb.ESentenceTraversal].Derivation* derivation
+ * 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
*/
static PyObject *__pyx_pf_5_cdec_10Hypergraph_10kbest(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
@@ -3875,7 +4463,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_12generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_12generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -3912,20 +4500,20 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator2(__pyx_GeneratorObject
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":33
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":32
*
* def kbest(self, size):
- * cdef kb.KBestDerivations[vector[WordID], kb.ESentenceTraversal]* derivations = new kb.KBestDerivations[vector[WordID], kb.ESentenceTraversal](self.hg[0], size) # <<<<<<<<<<<<<<
- * cdef kb.KBestDerivations[vector[WordID], kb.ESentenceTraversal].Derivation* derivation
- * cdef bytes sentence
+ * 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[2]; __pyx_lineno = 33; __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[2]; __pyx_lineno = 32; __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":37
- * cdef bytes sentence
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":35
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal].Derivation* derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
* for k in range(size):
@@ -3933,32 +4521,32 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator2(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":38
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":36
* 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[2]; __pyx_lineno = 38; __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[2]; __pyx_lineno = 36; __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":39
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":37
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
* if not derivation: break
- * sentence = GetString(derivation._yield).c_str()
+ * yield unicode(GetString(derivation._yield).c_str(), 'utf8')
*/
__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":40
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":38
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
- * sentence = GetString(derivation._yield).c_str()
- * yield sentence.decode('utf8')
+ * yield unicode(GetString(derivation._yield).c_str(), 'utf8')
+ * finally:
*/
__pyx_t_3 = (!(__pyx_cur_scope->__pyx_v_derivation != 0));
if (__pyx_t_3) {
@@ -3967,35 +4555,28 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator2(__pyx_GeneratorObject
}
__pyx_L9:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":39
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
- * sentence = GetString(derivation._yield).c_str() # <<<<<<<<<<<<<<
- * yield sentence.decode('utf8')
+ * 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[2]; __pyx_lineno = 41; __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[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_sentence));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_sentence));
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __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));
- __pyx_cur_scope->__pyx_v_sentence = __pyx_t_4;
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__pyx_t_4 = 0;
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":42
- * if not derivation: break
- * sentence = GetString(derivation._yield).c_str()
- * yield sentence.decode('utf8') # <<<<<<<<<<<<<<
- * finally:
- * del derivations
- */
- __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_sentence), __pyx_n_s__decode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __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[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__Pyx_XGIVEREF(__pyx_r);
@@ -4006,17 +4587,17 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator2(__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[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L5;}
}
__pyx_L8_break:;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":44
- * yield sentence.decode('utf8')
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":41
+ * yield unicode(GetString(derivation._yield).c_str(), 'utf8')
* finally:
* del derivations # <<<<<<<<<<<<<<
*
- * def kbest_tree(self, size):
+ * def kbest_trees(self, size):
*/
/*finally:*/ {
int __pyx_why;
@@ -4026,8 +4607,8 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator2(__pyx_GeneratorObject
__pyx_why = 0; goto __pyx_L6;
__pyx_L5: {
__pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
__pyx_exc_lineno = __pyx_lineno;
goto __pyx_L6;
@@ -4060,33 +4641,33 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_12generator2(__pyx_GeneratorObject
static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_14kbest_tree(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
-static PyObject *__pyx_pw_5_cdec_10Hypergraph_14kbest_tree(PyObject *__pyx_v_self, PyObject *__pyx_v_size) {
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_14kbest_trees(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_14kbest_trees(PyObject *__pyx_v_self, PyObject *__pyx_v_size) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("kbest_tree (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_10Hypergraph_13kbest_tree(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+ __Pyx_RefNannySetupContext("kbest_trees (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_13kbest_trees(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":46
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":43
* del derivations
*
- * def kbest_tree(self, size): # <<<<<<<<<<<<<<
- * cdef kb.KBestDerivations[vector[WordID], kb.ETreeTraversal]* derivations = new kb.KBestDerivations[vector[WordID], kb.ETreeTraversal](self.hg[0], size)
- * cdef kb.KBestDerivations[vector[WordID], kb.ETreeTraversal].Derivation* derivation
+ * 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
*/
-static PyObject *__pyx_pf_5_cdec_10Hypergraph_13kbest_tree(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree *__pyx_cur_scope;
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_13kbest_trees(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_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("kbest_tree", 0);
- __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree *)__pyx_ptype_5_cdec___pyx_scope_struct_3_kbest_tree->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_3_kbest_tree, __pyx_empty_tuple, NULL);
+ __Pyx_RefNannySetupContext("kbest_trees", 0);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees *)__pyx_ptype_5_cdec___pyx_scope_struct_3_kbest_trees->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_3_kbest_trees, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -4099,7 +4680,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_13kbest_tree(struct __pyx_obj_5_cd
__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_15generator3, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_15generator3, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -4108,7 +4689,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_13kbest_tree(struct __pyx_obj_5_cd
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_AddTraceback("_cdec.Hypergraph.kbest_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("_cdec.Hypergraph.kbest_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
@@ -4119,13 +4700,15 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_13kbest_tree(struct __pyx_obj_5_cd
static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
unsigned int __pyx_t_1;
long __pyx_t_2;
int __pyx_t_3;
- PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_4;
+ int __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
@@ -4136,91 +4719,155 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator3(__pyx_GeneratorObject
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":47
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":44
*
- * def kbest_tree(self, size):
- * cdef kb.KBestDerivations[vector[WordID], kb.ETreeTraversal]* derivations = new kb.KBestDerivations[vector[WordID], kb.ETreeTraversal](self.hg[0], size) # <<<<<<<<<<<<<<
- * cdef kb.KBestDerivations[vector[WordID], kb.ETreeTraversal].Derivation* derivation
- * cdef str tree
+ * 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[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __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[2]; __pyx_lineno = 44; __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":51
- * cdef str tree
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":46
+ * 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[2]; __pyx_lineno = 46; __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
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal].Derivation* e_derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
* for k in range(size):
- * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
+ * f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
*/
/*try:*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":52
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":50
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
- * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
- * if not derivation: break
+ * 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[2]; __pyx_lineno = 52; __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[2]; __pyx_lineno = 50; __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":53
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":51
* try:
* for k in range(size):
- * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
- * if not derivation: break
- * tree = GetString(derivation._yield).c_str()
+ * 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
*/
- __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);
+ __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":54
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":52
* for k in range(size):
- * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
- * if not derivation: break # <<<<<<<<<<<<<<
- * tree = GetString(derivation._yield).c_str()
- * yield tree.decode('utf8')
+ * 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
+ * f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8')
*/
- __pyx_t_3 = (!(__pyx_cur_scope->__pyx_v_derivation != 0));
- if (__pyx_t_3) {
+ __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
+ * 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 # <<<<<<<<<<<<<<
+ * f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8')
+ * e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8')
+ */
+ __pyx_t_3 = (!(__pyx_cur_scope->__pyx_v_f_derivation != 0));
+ if (!__pyx_t_3) {
+ __pyx_t_4 = (!(__pyx_cur_scope->__pyx_v_e_derivation != 0));
+ __pyx_t_5 = __pyx_t_4;
+ } else {
+ __pyx_t_5 = __pyx_t_3;
+ }
+ if (__pyx_t_5) {
goto __pyx_L8_break;
goto __pyx_L9;
}
__pyx_L9:;
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":54
+ * 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[2]; __pyx_lineno = 54; __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[2]; __pyx_lineno = 54; __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));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
+ 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[2]; __pyx_lineno = 54; __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));
+ __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_cur_scope->__pyx_v_f_tree = ((PyObject*)__pyx_t_6);
+ __pyx_t_6 = 0;
+
/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":55
- * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
- * if not derivation: break
- * tree = GetString(derivation._yield).c_str() # <<<<<<<<<<<<<<
- * yield tree.decode('utf8')
+ * 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_4 = PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_derivation->yield).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- if (!(likely(PyString_CheckExact(((PyObject *)__pyx_t_4)))||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(((PyObject *)__pyx_t_4))->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_tree));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_tree));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __pyx_cur_scope->__pyx_v_tree = ((PyObject*)__pyx_t_4);
- __pyx_t_4 = 0;
+ __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[2]; __pyx_lineno = 55; __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[2]; __pyx_lineno = 55; __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));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
+ 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[2]; __pyx_lineno = 55; __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));
+ __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_cur_scope->__pyx_v_e_tree = ((PyObject*)__pyx_t_6);
+ __pyx_t_6 = 0;
/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":56
- * if not derivation: break
- * tree = GetString(derivation._yield).c_str()
- * yield tree.decode('utf8') # <<<<<<<<<<<<<<
+ * 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 derivations
+ * del f_derivations
*/
- __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_tree), __pyx_n_s__decode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 56; __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));
+ __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
+ __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
+ PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
+ __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
+ __pyx_r = ((PyObject *)__pyx_t_6);
+ __pyx_t_6 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__Pyx_XGIVEREF(__pyx_r);
@@ -4237,11 +4884,11 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator3(__pyx_GeneratorObject
}
/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":58
- * yield tree.decode('utf8')
+ * yield (f_tree, e_tree)
* finally:
- * del derivations # <<<<<<<<<<<<<<
+ * del f_derivations # <<<<<<<<<<<<<<
+ * del e_derivations
*
- * def kbest_features(self, size):
*/
/*finally:*/ {
int __pyx_why;
@@ -4251,14 +4898,23 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator3(__pyx_GeneratorObject
__pyx_why = 0; goto __pyx_L6;
__pyx_L5: {
__pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 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_derivations;
+ delete __pyx_cur_scope->__pyx_v_f_derivations;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":59
+ * finally:
+ * del f_derivations
+ * del e_derivations # <<<<<<<<<<<<<<
+ *
+ * def kbest_features(self, size):
+ */
+ delete __pyx_cur_scope->__pyx_v_e_derivations;
switch (__pyx_why) {
case 4: {
__Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
@@ -4273,9 +4929,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_15generator3(__pyx_GeneratorObject
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_5);
- __Pyx_AddTraceback("kbest_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("kbest_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
__pyx_generator->resume_label = -1;
@@ -4295,12 +4951,12 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_17kbest_features(PyObject *__pyx_v
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":60
- * del derivations
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":61
+ * del e_derivations
*
* def kbest_features(self, size): # <<<<<<<<<<<<<<
- * cdef kb.KBestDerivations[FastSparseVector[weight_t], kb.FeatureVectorTraversal]* derivations = new kb.KBestDerivations[FastSparseVector[weight_t], kb.FeatureVectorTraversal](self.hg[0], size)
- * cdef kb.KBestDerivations[FastSparseVector[weight_t], kb.FeatureVectorTraversal].Derivation* derivation
+ * 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
*/
static PyObject *__pyx_pf_5_cdec_10Hypergraph_16kbest_features(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
@@ -4324,7 +4980,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_18generator4, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_18generator4, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -4360,19 +5016,19 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator4(__pyx_GeneratorObject
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":61
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":62
*
* def kbest_features(self, size):
- * cdef kb.KBestDerivations[FastSparseVector[weight_t], kb.FeatureVectorTraversal]* derivations = new kb.KBestDerivations[FastSparseVector[weight_t], kb.FeatureVectorTraversal](self.hg[0], size) # <<<<<<<<<<<<<<
- * cdef kb.KBestDerivations[FastSparseVector[weight_t], kb.FeatureVectorTraversal].Derivation* derivation
+ * 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[2]; __pyx_lineno = 61; __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[2]; __pyx_lineno = 62; __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":65
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":66
* cdef SparseVector fmap
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -4381,18 +5037,18 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator4(__pyx_GeneratorObject
*/
/*try:*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":66
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":67
* 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[2]; __pyx_lineno = 66; __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[2]; __pyx_lineno = 67; __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":67
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":68
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -4401,7 +5057,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator4(__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":68
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":69
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
@@ -4415,14 +5071,14 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator4(__pyx_GeneratorObject
}
__pyx_L9:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":69
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":70
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
* fmap = SparseVector() # <<<<<<<<<<<<<<
* fmap.vector = new FastSparseVector[weight_t](derivation._yield)
* yield fmap
*/
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L5;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
__Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
@@ -4430,7 +5086,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator4(__pyx_GeneratorObject
__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":70
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":71
* if not derivation: break
* fmap = SparseVector()
* fmap.vector = new FastSparseVector[weight_t](derivation._yield) # <<<<<<<<<<<<<<
@@ -4439,7 +5095,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator4(__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":71
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":72
* fmap = SparseVector()
* fmap.vector = new FastSparseVector[weight_t](derivation._yield)
* yield fmap # <<<<<<<<<<<<<<
@@ -4458,12 +5114,12 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_18generator4(__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[2]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L5;}
}
__pyx_L8_break:;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":73
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":74
* yield fmap
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -4517,7 +5173,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[2]; __pyx_lineno = 75; __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[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -4530,7 +5186,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_20sample(PyObject *__pyx_v_self, P
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":75
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":76
* del derivations
*
* def sample(self, unsigned n): # <<<<<<<<<<<<<<
@@ -4557,7 +5213,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_21generator5, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_21generator5, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -4594,9 +5250,9 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator5(__pyx_GeneratorObject
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":76
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":77
*
* def sample(self, unsigned n):
* cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() # <<<<<<<<<<<<<<
@@ -4605,7 +5261,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator5(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_hypos = new std::vector<HypergraphSampler::Hypothesis>();
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":77
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":78
* def sample(self, unsigned n):
* cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
* if self.rng == NULL: # <<<<<<<<<<<<<<
@@ -4615,33 +5271,33 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator5(__pyx_GeneratorObject
__pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->rng == NULL);
if (__pyx_t_1) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":78
+ /* "/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 str sentence
+ * cdef unsigned k
*/
__pyx_cur_scope->__pyx_v_self->rng = new MT19937();
goto __pyx_L4;
}
__pyx_L4:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":79
+ /* "/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) # <<<<<<<<<<<<<<
- * cdef str sentence
* 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);
/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":82
- * cdef str sentence
+ * hypergraph.sample_hypotheses(self.hg[0], n, self.rng, hypos)
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
* for k in range(hypos.size()):
- * sentence = GetString(hypos[0][k].words).c_str()
+ * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8')
*/
/*try:*/ {
@@ -4649,8 +5305,8 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator5(__pyx_GeneratorObject
* cdef unsigned k
* try:
* for k in range(hypos.size()): # <<<<<<<<<<<<<<
- * sentence = GetString(hypos[0][k].words).c_str()
- * yield sentence.decode('utf8')
+ * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8')
+ * finally:
*/
__pyx_t_2 = __pyx_cur_scope->__pyx_v_hypos->size();
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
@@ -4659,33 +5315,25 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator5(__pyx_GeneratorObject
/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":84
* try:
* for k in range(hypos.size()):
- * sentence = GetString(hypos[0][k].words).c_str() # <<<<<<<<<<<<<<
- * yield sentence.decode('utf8')
+ * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8') # <<<<<<<<<<<<<<
* finally:
+ * del hypos
*/
__pyx_t_4 = PyBytes_FromString(TD::GetString(((__pyx_cur_scope->__pyx_v_hypos[0])[__pyx_cur_scope->__pyx_v_k]).words).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
- if (!(likely(PyString_CheckExact(((PyObject *)__pyx_t_4)))||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(((PyObject *)__pyx_t_4))->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;}
- __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_sentence));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_sentence));
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
__Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __pyx_cur_scope->__pyx_v_sentence = ((PyObject*)__pyx_t_4);
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
__pyx_t_4 = 0;
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":85
- * for k in range(hypos.size()):
- * sentence = GetString(hypos[0][k].words).c_str()
- * yield sentence.decode('utf8') # <<<<<<<<<<<<<<
- * finally:
- * del hypos
- */
- __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_sentence), __pyx_n_s__decode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L6;}
+ __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L6;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
__Pyx_XGIVEREF(__pyx_r);
@@ -4696,16 +5344,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator5(__pyx_GeneratorObject
__pyx_L10_resume_from_yield:;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L6;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L6;}
}
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":87
- * yield sentence.decode('utf8')
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":86
+ * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8')
* finally:
* del hypos # <<<<<<<<<<<<<<
*
- * # TODO richer k-best/sample output (feature vectors, trees?)
+ * def intersect(self, Lattice lat):
*/
/*finally:*/ {
int __pyx_why;
@@ -4715,8 +5363,8 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_21generator5(__pyx_GeneratorObject
__pyx_why = 0; goto __pyx_L7;
__pyx_L6: {
__pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
__pyx_exc_lineno = __pyx_lineno;
goto __pyx_L7;
@@ -4753,7 +5401,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_23intersect(PyObject *__pyx_v_self
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("intersect (wrapper)", 0);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lat), __pyx_ptype_5_cdec_Lattice, 1, "lat", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lat), __pyx_ptype_5_cdec_Lattice, 1, "lat", 0))) {__pyx_filename = __pyx_f[2]; __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));
goto __pyx_L0;
__pyx_L1_error:;
@@ -4763,8 +5411,8 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_23intersect(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":91
- * # TODO richer k-best/sample output (feature vectors, trees?)
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":88
+ * del hypos
*
* def intersect(self, Lattice lat): # <<<<<<<<<<<<<<
* return hypergraph.Intersect(lat.lattice[0], self.hg)
@@ -4780,7 +5428,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":92
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":89
*
* def intersect(self, Lattice lat):
* return hypergraph.Intersect(lat.lattice[0], self.hg) # <<<<<<<<<<<<<<
@@ -4788,7 +5436,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[2]; __pyx_lineno = 92; __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[2]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -4845,7 +5493,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[2]; __pyx_lineno = 94; __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[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -4860,7 +5508,7 @@ 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[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("prune", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __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);
@@ -4873,7 +5521,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_25prune(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":94
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":91
* return hypergraph.Intersect(lat.lattice[0], self.hg)
*
* def prune(self, beam_alpha=0, density=0, **kwargs): # <<<<<<<<<<<<<<
@@ -4893,7 +5541,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":95
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":92
*
* def prune(self, beam_alpha=0, density=0, **kwargs):
* cdef hypergraph.EdgeMask* preserve_mask = NULL # <<<<<<<<<<<<<<
@@ -4902,17 +5550,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":96
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":93
* 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_10)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s_6)))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":97
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":94
* cdef hypergraph.EdgeMask* preserve_mask = NULL
* if 'csplit_preserve_full_word' in kwargs:
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size()) # <<<<<<<<<<<<<<
@@ -4921,7 +5569,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":98
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":95
* 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 # <<<<<<<<<<<<<<
@@ -4933,18 +5581,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":99
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":96
* 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[2]; __pyx_lineno = 99; __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[2]; __pyx_lineno = 99; __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[2]; __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[2]; __pyx_lineno = 96; __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":100
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":97
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False)
* if preserve_mask: # <<<<<<<<<<<<<<
@@ -4954,7 +5602,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":101
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":98
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False)
* if preserve_mask:
* del preserve_mask # <<<<<<<<<<<<<<
@@ -4988,7 +5636,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_27lattice(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":103
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":100
* del preserve_mask
*
* def lattice(self): # TODO direct hg -> lattice conversion in cdec # <<<<<<<<<<<<<<
@@ -5008,20 +5656,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":104
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":101
*
* 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[2]; __pyx_lineno = 104; __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[2]; __pyx_lineno = 101; __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[2]; __pyx_lineno = 104; __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[2]; __pyx_lineno = 101; __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":105
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":102
* 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)) # <<<<<<<<<<<<<<
@@ -5029,17 +5677,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[2]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __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[2]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __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[2]; __pyx_lineno = 105; __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[2]; __pyx_lineno = 102; __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[2]; __pyx_lineno = 105; __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[2]; __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[2]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __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));
@@ -5050,15 +5698,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[2]; __pyx_lineno = 105; __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[2]; __pyx_lineno = 102; __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[2]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 102; __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[2]; __pyx_lineno = 105; __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[2]; __pyx_lineno = 102; __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;
@@ -5091,7 +5739,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_29reweight(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":107
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":104
* return Lattice(eval(plf))
*
* def reweight(self, weights): # <<<<<<<<<<<<<<
@@ -5110,7 +5758,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":108
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":105
*
* def reweight(self, weights):
* if isinstance(weights, SparseVector): # <<<<<<<<<<<<<<
@@ -5123,7 +5771,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":109
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":106
* def reweight(self, weights):
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0]) # <<<<<<<<<<<<<<
@@ -5134,7 +5782,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":110
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":107
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0])
* elif isinstance(weights, DenseVector): # <<<<<<<<<<<<<<
@@ -5147,7 +5795,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":111
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":108
* self.hg.Reweight((<SparseVector> weights).vector[0])
* elif isinstance(weights, DenseVector):
* self.hg.Reweight((<DenseVector> weights).vector[0]) # <<<<<<<<<<<<<<
@@ -5159,26 +5807,26 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_28reweight(struct __pyx_obj_5_cdec
}
/*else*/ {
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":113
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":110
* self.hg.Reweight((<DenseVector> weights).vector[0])
* else:
* raise TypeError('cannot reweight hypergraph with %s' % type(weights)) # <<<<<<<<<<<<<<
*
* # TODO get feature expectations, get partition function ("inside" score)
*/
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __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[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __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[2]; __pyx_lineno = 113; __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[2]; __pyx_lineno = 110; __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[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -5194,6 +5842,2653 @@ 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_2generator6(__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*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_5edges___get__(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":115
+ *
+ * property edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.edges_.size()):
+ */
+
+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_6___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_6___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_6___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_6___get__, __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_5edges_2generator6, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 115; __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.edges.__get__", __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_5edges_2generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+{
+ struct __pyx_obj_5_cdec___pyx_scope_struct_6___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_6___get__ *)__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_L6_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[2]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":117
+ * def __get__(self):
+ * cdef unsigned i
+ * for i in range(self.hg.edges_.size()): # <<<<<<<<<<<<<<
+ * yield HypergraphEdge().init(self.hg, i)
+ *
+ */
+ __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->hg->edges_.size();
+ 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":118
+ * 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[2]; __pyx_lineno = 118; __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[2]; __pyx_lineno = 118; __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;
+ __pyx_t_4 = 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_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[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; 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("__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_generator->resume_label = -1;
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+}
+static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator7(__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*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_5nodes___get__(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":121
+ *
+ * property nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.nodes_.size()):
+ */
+
+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_7___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_7___get__ *)__pyx_ptype_5_cdec___pyx_scope_struct_7___get__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_7___get__, __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_5nodes_2generator7, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __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.nodes.__get__", __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_5nodes_2generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+{
+ struct __pyx_obj_5_cdec___pyx_scope_struct_7___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_7___get__ *)__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_L6_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[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":123
+ * def __get__(self):
+ * cdef unsigned i
+ * for i in range(self.hg.nodes_.size()): # <<<<<<<<<<<<<<
+ * yield HypergraphNode().init(self.hg, i)
+ *
+ */
+ __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->hg->nodes_.size();
+ 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":124
+ * 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[2]; __pyx_lineno = 124; __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[2]; __pyx_lineno = 124; __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;
+ __pyx_t_4 = 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_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[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; 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("__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_generator->resume_label = -1;
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_10Hypergraph_4goal___get__(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":127
+ *
+ * property goal:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return HypergraphNode().init(self.hg, self.hg.GoalNode())
+ *
+ */
+
+static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":128
+ * property goal:
+ * def __get__(self):
+ * return HypergraphNode().init(self.hg, self.hg.GoalNode()) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __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[2]; __pyx_lineno = 128; __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[2]; __pyx_lineno = 128; __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;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_cdec.Hypergraph.goal.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_1_phrase(PyObject *__pyx_self, PyObject *__pyx_v_phrase); /*proto*/
+static PyMethodDef __pyx_mdef_5_cdec_1_phrase = {__Pyx_NAMESTR("_phrase"), (PyCFunction)__pyx_pw_5_cdec_1_phrase, METH_O, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5_cdec_1_phrase(PyObject *__pyx_self, PyObject *__pyx_v_phrase) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("_phrase (wrapper)", 0);
+ __pyx_self = __pyx_self;
+ __pyx_r = __pyx_pf_5_cdec__phrase(__pyx_self, ((PyObject *)__pyx_v_phrase));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+static PyObject *__pyx_gb_5_cdec_7_phrase_2generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":2
+ * def _phrase(phrase):
+ * return ' '.join('[%s,%d]' % w if isinstance(w, tuple) else w.encode('utf8') for w in phrase) # <<<<<<<<<<<<<<
+ *
+ * cdef class TRule:
+ */
+
+static PyObject *__pyx_pf_5_cdec_7_phrase_genexpr(PyObject *__pyx_self) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_9_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_9_genexpr *)__pyx_ptype_5_cdec___pyx_scope_struct_9_genexpr->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_9_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_8__phrase *) __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_2generator15, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __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._phrase.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_gb_5_cdec_7_phrase_2generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+{
+ struct __pyx_obj_5_cdec___pyx_scope_struct_9_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_9_genexpr *)__pyx_generator->closure);
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ Py_ssize_t __pyx_t_2;
+ PyObject *(*__pyx_t_3)(PyObject *);
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("None", 0);
+ switch (__pyx_generator->resume_label) {
+ case 0: goto __pyx_L3_first_run;
+ case 1: goto __pyx_L6_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[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase)) { __Pyx_RaiseClosureNameError("phrase"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase)) {
+ __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
+ __pyx_t_3 = NULL;
+ } else {
+ __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ }
+ for (;;) {
+ if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+ } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+ } else {
+ __pyx_t_4 = __pyx_t_3(__pyx_t_1);
+ if (unlikely(!__pyx_t_4)) {
+ if (PyErr_Occurred()) {
+ if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_4);
+ }
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_w);
+ __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_w);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_cur_scope->__pyx_v_w = __pyx_t_4;
+ __pyx_t_4 = 0;
+ __pyx_t_5 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
+ __Pyx_INCREF(__pyx_t_5);
+ __pyx_t_6 = __Pyx_TypeCheck(__pyx_cur_scope->__pyx_v_w, __pyx_t_5);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (__pyx_t_6) {
+ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_cur_scope->__pyx_v_w); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ __pyx_t_4 = ((PyObject *)__pyx_t_5);
+ __pyx_t_5 = 0;
+ } else {
+ __pyx_t_5 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_w, __pyx_n_s__encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_4 = __pyx_t_7;
+ __pyx_t_7 = 0;
+ }
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ /* return from generator, yielding value */
+ __pyx_generator->resume_label = 1;
+ return __pyx_r;
+ __pyx_L6_resume_from_yield:;
+ __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_cur_scope->__pyx_t_0 = 0;
+ __Pyx_XGOTREF(__pyx_t_1);
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ PyErr_SetNone(PyExc_StopIteration);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_generator->resume_label = -1;
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":1
+ * def _phrase(phrase): # <<<<<<<<<<<<<<
+ * return ' '.join('[%s,%d]' % w if isinstance(w, tuple) else w.encode('utf8') for w in phrase)
+ *
+ */
+
+static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_phrase) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase *__pyx_cur_scope;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_phrase", 0);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase *)__pyx_ptype_5_cdec___pyx_scope_struct_8__phrase->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_8__phrase, __pyx_empty_tuple, NULL);
+ if (unlikely(!__pyx_cur_scope)) {
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ }
+ __Pyx_GOTREF(__pyx_cur_scope);
+ __pyx_cur_scope->__pyx_v_phrase = __pyx_v_phrase;
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":2
+ * def _phrase(phrase):
+ * return ' '.join('[%s,%d]' % w if isinstance(w, tuple) else w.encode('utf8') for w in phrase) # <<<<<<<<<<<<<<
+ *
+ * cdef class TRule:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_10), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __pyx_pf_5_cdec_7_phrase_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("_cdec._phrase", __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;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_5TRule_5arity___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":8
+ *
+ * property arity:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.rule.arity_
+ *
+ */
+
+static PyObject *__pyx_pf_5_cdec_5TRule_5arity___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":9
+ * property arity:
+ * def __get__(self):
+ * return self.rule.arity_ # <<<<<<<<<<<<<<
+ *
+ * property f:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = PyInt_FromLong(__pyx_v_self->rule->arity_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_cdec.TRule.arity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_5TRule_1f___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":12
+ *
+ * property f:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* f = &self.rule.f_
+ * cdef WordID w
+ */
+
+static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) {
+ std::vector<WordID> *__pyx_v_f;
+ WordID __pyx_v_w;
+ PyObject *__pyx_v_words = 0;
+ unsigned int __pyx_v_i;
+ int __pyx_v_idx;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ size_t __pyx_t_2;
+ unsigned int __pyx_t_3;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":13
+ * property f:
+ * def __get__(self):
+ * cdef vector[WordID]* f = &self.rule.f_ # <<<<<<<<<<<<<<
+ * cdef WordID w
+ * cdef words = []
+ */
+ __pyx_v_f = (&__pyx_v_self->rule->f_);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":15
+ * cdef vector[WordID]* f = &self.rule.f_
+ * cdef WordID w
+ * cdef words = [] # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * cdef int idx = 0
+ */
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_words = ((PyObject *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":17
+ * cdef words = []
+ * cdef unsigned i
+ * cdef int idx = 0 # <<<<<<<<<<<<<<
+ * for i in range(f.size()):
+ * w = f[0][i]
+ */
+ __pyx_v_idx = 0;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":18
+ * cdef unsigned i
+ * cdef int idx = 0
+ * for i in range(f.size()): # <<<<<<<<<<<<<<
+ * w = f[0][i]
+ * if w < 0:
+ */
+ __pyx_t_2 = __pyx_v_f->size();
+ 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/trule.pxi":19
+ * cdef int idx = 0
+ * for i in range(f.size()):
+ * w = f[0][i] # <<<<<<<<<<<<<<
+ * if w < 0:
+ * idx += 1
+ */
+ __pyx_v_w = ((__pyx_v_f[0])[__pyx_v_i]);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":20
+ * for i in range(f.size()):
+ * w = f[0][i]
+ * if w < 0: # <<<<<<<<<<<<<<
+ * idx += 1
+ * words.append((TDConvert(-w), idx))
+ */
+ __pyx_t_4 = (__pyx_v_w < 0);
+ if (__pyx_t_4) {
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":21
+ * w = f[0][i]
+ * if w < 0:
+ * idx += 1 # <<<<<<<<<<<<<<
+ * words.append((TDConvert(-w), idx))
+ * else:
+ */
+ __pyx_v_idx = (__pyx_v_idx + 1);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":22
+ * if w < 0:
+ * idx += 1
+ * words.append((TDConvert(-w), idx)) # <<<<<<<<<<<<<<
+ * else:
+ * words.append(unicode(TDConvert(w), encoding='utf8'))
+ */
+ __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_w))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_1 = 0;
+ __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_words, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L5;
+ }
+ /*else*/ {
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":24
+ * words.append((TDConvert(-w), idx))
+ * else:
+ * words.append(unicode(TDConvert(w), encoding='utf8')) # <<<<<<<<<<<<<<
+ * return words
+ *
+ */
+ __pyx_t_5 = PyBytes_FromString(TD::Convert(__pyx_v_w)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+ __pyx_t_5 = 0;
+ __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_words, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __pyx_L5:;
+ }
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":25
+ * else:
+ * words.append(unicode(TDConvert(w), encoding='utf8'))
+ * return words # <<<<<<<<<<<<<<
+ *
+ * property e:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_words);
+ __pyx_r = __pyx_v_words;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("_cdec.TRule.f.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_words);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_5TRule_1e___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":28
+ *
+ * property e:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* e = &self.rule.e_
+ * cdef WordID w
+ */
+
+static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) {
+ std::vector<WordID> *__pyx_v_e;
+ WordID __pyx_v_w;
+ PyObject *__pyx_v_words = 0;
+ unsigned int __pyx_v_i;
+ int __pyx_v_idx;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ size_t __pyx_t_2;
+ unsigned int __pyx_t_3;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":29
+ * property e:
+ * def __get__(self):
+ * cdef vector[WordID]* e = &self.rule.e_ # <<<<<<<<<<<<<<
+ * cdef WordID w
+ * cdef words = []
+ */
+ __pyx_v_e = (&__pyx_v_self->rule->e_);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":31
+ * cdef vector[WordID]* e = &self.rule.e_
+ * cdef WordID w
+ * cdef words = [] # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * cdef int idx = 0
+ */
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_words = ((PyObject *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":33
+ * cdef words = []
+ * cdef unsigned i
+ * cdef int idx = 0 # <<<<<<<<<<<<<<
+ * for i in range(e.size()):
+ * w = e[0][i]
+ */
+ __pyx_v_idx = 0;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":34
+ * cdef unsigned i
+ * cdef int idx = 0
+ * for i in range(e.size()): # <<<<<<<<<<<<<<
+ * w = e[0][i]
+ * if w < 1:
+ */
+ __pyx_t_2 = __pyx_v_e->size();
+ 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/trule.pxi":35
+ * cdef int idx = 0
+ * for i in range(e.size()):
+ * w = e[0][i] # <<<<<<<<<<<<<<
+ * if w < 1:
+ * idx += 1
+ */
+ __pyx_v_w = ((__pyx_v_e[0])[__pyx_v_i]);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":36
+ * for i in range(e.size()):
+ * w = e[0][i]
+ * if w < 1: # <<<<<<<<<<<<<<
+ * idx += 1
+ * words.append((TDConvert(1-w), idx))
+ */
+ __pyx_t_4 = (__pyx_v_w < 1);
+ if (__pyx_t_4) {
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":37
+ * w = e[0][i]
+ * if w < 1:
+ * idx += 1 # <<<<<<<<<<<<<<
+ * words.append((TDConvert(1-w), idx))
+ * else:
+ */
+ __pyx_v_idx = (__pyx_v_idx + 1);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":38
+ * if w < 1:
+ * idx += 1
+ * words.append((TDConvert(1-w), idx)) # <<<<<<<<<<<<<<
+ * else:
+ * words.append(unicode(TDConvert(w), encoding='utf8'))
+ */
+ __pyx_t_1 = PyBytes_FromString(TD::Convert((1 - __pyx_v_w))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_1 = 0;
+ __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_words, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L5;
+ }
+ /*else*/ {
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":40
+ * words.append((TDConvert(1-w), idx))
+ * else:
+ * words.append(unicode(TDConvert(w), encoding='utf8')) # <<<<<<<<<<<<<<
+ * return words
+ *
+ */
+ __pyx_t_5 = PyBytes_FromString(TD::Convert(__pyx_v_w)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+ __pyx_t_5 = 0;
+ __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_words, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __pyx_L5:;
+ }
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":41
+ * else:
+ * words.append(unicode(TDConvert(w), encoding='utf8'))
+ * return words # <<<<<<<<<<<<<<
+ *
+ * property scores:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_words);
+ __pyx_r = __pyx_v_words;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("_cdec.TRule.e.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_words);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_5TRule_6scores___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":44
+ *
+ * property scores:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector scores = SparseVector()
+ * scores.vector = new FastSparseVector[double](self.rule.scores_)
+ */
+
+static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) {
+ struct __pyx_obj_5_cdec_SparseVector *__pyx_v_scores = 0;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":45
+ * property scores:
+ * def __get__(self):
+ * cdef SparseVector scores = SparseVector() # <<<<<<<<<<<<<<
+ * scores.vector = new FastSparseVector[double](self.rule.scores_)
+ * return scores
+ */
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_scores = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":46
+ * def __get__(self):
+ * cdef SparseVector scores = SparseVector()
+ * scores.vector = new FastSparseVector[double](self.rule.scores_) # <<<<<<<<<<<<<<
+ * return scores
+ *
+ */
+ __pyx_v_scores->vector = new FastSparseVector<double>(__pyx_v_self->rule->scores_);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":47
+ * cdef SparseVector scores = SparseVector()
+ * scores.vector = new FastSparseVector[double](self.rule.scores_)
+ * return scores # <<<<<<<<<<<<<<
+ *
+ * property lhs:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(((PyObject *)__pyx_v_scores));
+ __pyx_r = ((PyObject *)__pyx_v_scores);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_cdec.TRule.scores.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_scores);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_5TRule_3lhs___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":50
+ *
+ * property lhs:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return TDConvert(-self.rule.lhs_)
+ *
+ */
+
+static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":51
+ * property lhs:
+ * def __get__(self):
+ * return TDConvert(-self.rule.lhs_) # <<<<<<<<<<<<<<
+ *
+ * def __str__(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = PyBytes_FromString(TD::Convert((-__pyx_v_self->rule->lhs_))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_r = ((PyObject *)__pyx_t_1);
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_cdec.TRule.lhs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_5TRule_1__str__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_5TRule_1__str__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_5TRule___str__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":54
+ *
+ * def __str__(self):
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
+ * return '[%s] ||| %s ||| %s ||| %s' % (self.lhs, _phrase(self.f), _phrase(self.e), scores)
+ */
+
+static PyObject *__pyx_pf_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_self) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_11_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_11_genexpr *)__pyx_ptype_5_cdec___pyx_scope_struct_11_genexpr->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_11_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_10___str__ *) __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___2generator16, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __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.TRule.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+{
+ struct __pyx_obj_5_cdec___pyx_scope_struct_11_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_11_genexpr *)__pyx_generator->closure);
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ Py_ssize_t __pyx_t_3;
+ PyObject *(*__pyx_t_4)(PyObject *);
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("None", 0);
+ switch (__pyx_generator->resume_label) {
+ case 0: goto __pyx_L3_first_run;
+ case 1: goto __pyx_L6_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[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s__scores); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
+ __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
+ __pyx_t_4 = NULL;
+ } else {
+ __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ for (;;) {
+ if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
+ } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
+ } else {
+ __pyx_t_1 = __pyx_t_4(__pyx_t_2);
+ if (unlikely(!__pyx_t_1)) {
+ if (PyErr_Occurred()) {
+ if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ }
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_feat);
+ __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_feat);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_cur_scope->__pyx_v_feat = __pyx_t_1;
+ __pyx_t_1 = 0;
+ __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_r = ((PyObject *)__pyx_t_1);
+ __pyx_t_1 = 0;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ /* return from generator, yielding value */
+ __pyx_generator->resume_label = 1;
+ return __pyx_r;
+ __pyx_L6_resume_from_yield:;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_cur_scope->__pyx_t_0 = 0;
+ __Pyx_XGOTREF(__pyx_t_2);
+ __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ PyErr_SetNone(PyExc_StopIteration);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_generator->resume_label = -1;
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":53
+ * return TDConvert(-self.rule.lhs_)
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores)
+ * return '[%s] ||| %s ||| %s ||| %s' % (self.lhs, _phrase(self.f), _phrase(self.e), scores)
+ */
+
+static PyObject *__pyx_pf_5_cdec_5TRule___str__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__ *__pyx_cur_scope;
+ PyObject *__pyx_v_scores = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__str__", 0);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__ *)__pyx_ptype_5_cdec___pyx_scope_struct_10___str__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_10___str__, __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);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":54
+ *
+ * def __str__(self):
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
+ * return '[%s] ||| %s ||| %s ||| %s' % (self.lhs, _phrase(self.f), _phrase(self.e), scores)
+ */
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_10), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __pyx_pf_5_cdec_5TRule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __pyx_v_scores = __pyx_t_2;
+ __pyx_t_2 = 0;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":55
+ * def __str__(self):
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores)
+ * return '[%s] ||| %s ||| %s ||| %s' % (self.lhs, _phrase(self.f), _phrase(self.e), scores) # <<<<<<<<<<<<<<
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___phrase); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___phrase); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__e); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_scores);
+ PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_scores);
+ __Pyx_GIVEREF(__pyx_v_scores);
+ __pyx_t_2 = 0;
+ __pyx_t_1 = 0;
+ __pyx_t_3 = 0;
+ __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_r = ((PyObject *)__pyx_t_3);
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("_cdec.TRule.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_scores);
+ __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":138
+ * cdef public TRule trule
+ *
+ * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
+ * self.hg = hg
+ * self.edge = &hg.edges_[i]
+ */
+
+static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self, Hypergraph *__pyx_v_hg, unsigned int __pyx_v_i) {
+ 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("init", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":139
+ *
+ * cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
+ * self.hg = hg # <<<<<<<<<<<<<<
+ * self.edge = &hg.edges_[i]
+ * self.trule = TRule()
+ */
+ __pyx_v_self->hg = __pyx_v_hg;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":140
+ * cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
+ * self.hg = hg
+ * self.edge = &hg.edges_[i] # <<<<<<<<<<<<<<
+ * self.trule = TRule()
+ * self.trule.rule = self.edge.rule_.get()
+ */
+ __pyx_v_self->edge = (&(__pyx_v_hg->edges_[__pyx_v_i]));
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":141
+ * self.hg = hg
+ * self.edge = &hg.edges_[i]
+ * self.trule = TRule() # <<<<<<<<<<<<<<
+ * self.trule.rule = self.edge.rule_.get()
+ * return self
+ */
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_TRule)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __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":142
+ * self.edge = &hg.edges_[i]
+ * self.trule = TRule()
+ * self.trule.rule = self.edge.rule_.get() # <<<<<<<<<<<<<<
+ * return self
+ *
+ */
+ __pyx_v_self->trule->rule = __pyx_v_self->edge->rule_.get();
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":143
+ * self.trule = TRule()
+ * self.trule.rule = self.edge.rule_.get()
+ * return self # <<<<<<<<<<<<<<
+ *
+ * def __len__(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(((PyObject *)__pyx_v_self));
+ __pyx_r = ((PyObject *)__pyx_v_self);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_cdec.HypergraphEdge.init", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static Py_ssize_t __pyx_pw_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_pw_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_self) {
+ Py_ssize_t __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge___len__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":145
+ * return self
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.edge.tail_nodes_.size()
+ *
+ */
+
+static Py_ssize_t __pyx_pf_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) {
+ Py_ssize_t __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__len__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":146
+ *
+ * def __len__(self):
+ * return self.edge.tail_nodes_.size() # <<<<<<<<<<<<<<
+ *
+ * property head_node:
+ */
+ __pyx_r = __pyx_v_self->edge->tail_nodes_.size();
+ goto __pyx_L0;
+
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":149
+ *
+ * property head_node:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return HypergraphNode().init(self.hg, self.edge.head_node_)
+ *
+ */
+
+static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":150
+ * property head_node:
+ * def __get__(self):
+ * return HypergraphNode().init(self.hg, self.edge.head_node_) # <<<<<<<<<<<<<<
+ *
+ * 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[2]; __pyx_lineno = 150; __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[2]; __pyx_lineno = 150; __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;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_cdec.HypergraphEdge.head_node.__get__", __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_14HypergraphEdge_10tail_nodes_2generator8(__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*/
+static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":153
+ *
+ * property tail_nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.edge.tail_nodes_.size()):
+ */
+
+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_12___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);
+ 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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator8, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __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.HypergraphEdge.tail_nodes.__get__", __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_14HypergraphEdge_10tail_nodes_2generator8(__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);
+ PyObject *__pyx_r = NULL;
+ unsigned int __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_L6_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[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":155
+ * def __get__(self):
+ * cdef unsigned i
+ * for i in range(self.edge.tail_nodes_.size()): # <<<<<<<<<<<<<<
+ * yield HypergraphNode().init(self.hg, self.edge.tail_nodes_[i])
+ *
+ */
+ __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->edge->tail_nodes_.size();
+ 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":156
+ * 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[2]; __pyx_lineno = 156; __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[2]; __pyx_lineno = 156; __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;
+ __pyx_t_4 = 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_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[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; 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("__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_generator->resume_label = -1;
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_4span___get__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":159
+ *
+ * property span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return (self.edge.i_, self.edge.j_)
+ *
+ */
+
+static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":160
+ * property span:
+ * def __get__(self):
+ * return (self.edge.i_, self.edge.j_) # <<<<<<<<<<<<<<
+ *
+ * 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[2]; __pyx_lineno = 160; __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[2]; __pyx_lineno = 160; __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[2]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_1 = 0;
+ __pyx_t_2 = 0;
+ __pyx_r = ((PyObject *)__pyx_t_3);
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("_cdec.HypergraphEdge.span.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":163
+ *
+ * property feature_values:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector vector = SparseVector()
+ * vector.vector = new FastSparseVector[double](self.edge.feature_values_)
+ */
+
+static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) {
+ struct __pyx_obj_5_cdec_SparseVector *__pyx_v_vector = 0;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":164
+ * property feature_values:
+ * def __get__(self):
+ * cdef SparseVector vector = SparseVector() # <<<<<<<<<<<<<<
+ * vector.vector = new FastSparseVector[double](self.edge.feature_values_)
+ * return vector
+ */
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":165
+ * def __get__(self):
+ * cdef SparseVector vector = SparseVector()
+ * vector.vector = new FastSparseVector[double](self.edge.feature_values_) # <<<<<<<<<<<<<<
+ * return vector
+ *
+ */
+ __pyx_v_vector->vector = new FastSparseVector<double>(__pyx_v_self->edge->feature_values_);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":166
+ * cdef SparseVector vector = SparseVector()
+ * vector.vector = new FastSparseVector[double](self.edge.feature_values_)
+ * return vector # <<<<<<<<<<<<<<
+ *
+ * property prob:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(((PyObject *)__pyx_v_vector));
+ __pyx_r = ((PyObject *)__pyx_v_vector);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_cdec.HypergraphEdge.feature_values.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_vector);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":169
+ *
+ * property prob:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.edge.edge_prob_.as_float()
+ *
+ */
+
+static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":170
+ * property prob:
+ * def __get__(self):
+ * return self.edge.edge_prob_.as_float() # <<<<<<<<<<<<<<
+ *
+ * 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[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_cdec.HypergraphEdge.prob.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/
+static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
+ 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[2]; __pyx_lineno = 172; __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[2]; __pyx_lineno = 172; __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:;
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":172
+ * return self.edge.edge_prob_.as_float()
+ *
+ * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.edge == y.edge
+ */
+
+static PyObject *__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) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__richcmp__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":175
+ * if op == 2: # ==
+ * return x.edge == y.edge
+ * elif op == 3: # != # <<<<<<<<<<<<<<
+ * return not (x == y)
+ * raise NotImplemented('comparison not implemented for HypergraphEdge')
+ */
+ switch (__pyx_v_op) {
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":173
+ *
+ * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
+ * if op == 2: # == # <<<<<<<<<<<<<<
+ * return x.edge == y.edge
+ * elif op == 3: # !=
+ */
+ case 2:
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":174
+ * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
+ * if op == 2: # ==
+ * return x.edge == y.edge # <<<<<<<<<<<<<<
+ * elif op == 3: # !=
+ * 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[2]; __pyx_lineno = 174; __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":175
+ * if op == 2: # ==
+ * return x.edge == y.edge
+ * elif op == 3: # != # <<<<<<<<<<<<<<
+ * return not (x == y)
+ * raise NotImplemented('comparison not implemented for HypergraphEdge')
+ */
+ case 3:
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":176
+ * return x.edge == y.edge
+ * elif op == 3: # !=
+ * return not (x == y) # <<<<<<<<<<<<<<
+ * raise NotImplemented('comparison not implemented for HypergraphEdge')
+ *
+ */
+ __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[2]; __pyx_lineno = 176; __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[2]; __pyx_lineno = 176; __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[2]; __pyx_lineno = 176; __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":177
+ * 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_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __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[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_cdec.HypergraphEdge.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_5trule___get__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":136
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphEdge* edge
+ * cdef public TRule trule # <<<<<<<<<<<<<<
+ *
+ * cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
+ */
+
+static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_5trule___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(((PyObject *)__pyx_v_self->trule));
+ __pyx_r = ((PyObject *)__pyx_v_self->trule);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_5_cdec_14HypergraphEdge_5trule_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_5_cdec_14HypergraphEdge_5trule_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_5trule_2__set__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_2__set__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_lineno = 0;
+ 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[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(__pyx_v_value);
+ __Pyx_GIVEREF(__pyx_v_value);
+ __Pyx_GOTREF(__pyx_v_self->trule);
+ __Pyx_DECREF(((PyObject *)__pyx_v_self->trule));
+ __pyx_v_self->trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_v_value);
+
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("_cdec.HypergraphEdge.trule.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_5_cdec_14HypergraphEdge_5trule_5__del__(PyObject *__pyx_v_self); /*proto*/
+static int __pyx_pw_5_cdec_14HypergraphEdge_5trule_5__del__(PyObject *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_5trule_4__del__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__", 0);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->trule);
+ __Pyx_DECREF(((PyObject *)__pyx_v_self->trule));
+ __pyx_v_self->trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None);
+
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":183
+ * cdef hypergraph.HypergraphNode* node
+ *
+ * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
+ * self.hg = hg
+ * self.node = &hg.nodes_[i]
+ */
+
+static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self, Hypergraph *__pyx_v_hg, unsigned int __pyx_v_i) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("init", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":184
+ *
+ * cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
+ * self.hg = hg # <<<<<<<<<<<<<<
+ * self.node = &hg.nodes_[i]
+ * return self
+ */
+ __pyx_v_self->hg = __pyx_v_hg;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":185
+ * cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
+ * self.hg = hg
+ * self.node = &hg.nodes_[i] # <<<<<<<<<<<<<<
+ * return self
+ *
+ */
+ __pyx_v_self->node = (&(__pyx_v_hg->nodes_[__pyx_v_i]));
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":186
+ * self.hg = hg
+ * self.node = &hg.nodes_[i]
+ * return self # <<<<<<<<<<<<<<
+ *
+ * property in_edges:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(((PyObject *)__pyx_v_self));
+ __pyx_r = ((PyObject *)__pyx_v_self);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator9(__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*/
+static PyObject *__pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_14HypergraphNode_8in_edges___get__(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":189
+ *
+ * property in_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.in_edges_.size()):
+ */
+
+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_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_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;
+ }
+ __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator9, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 189; __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.HypergraphNode.in_edges.__get__", __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_14HypergraphNode_8in_edges_2generator9(__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);
+ 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_L6_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[2]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":191
+ * def __get__(self):
+ * cdef unsigned i
+ * for i in range(self.node.in_edges_.size()): # <<<<<<<<<<<<<<
+ * yield HypergraphEdge().init(self.hg, self.node.in_edges_[i])
+ *
+ */
+ __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->node->in_edges_.size();
+ 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":192
+ * 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[2]; __pyx_lineno = 192; __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[2]; __pyx_lineno = 192; __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;
+ __pyx_t_4 = 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_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[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; 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("__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_generator->resume_label = -1;
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+}
+static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator10(__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*/
+static PyObject *__pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":195
+ *
+ * property out_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.out_edges_.size()):
+ */
+
+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_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_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;
+ }
+ __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator10, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 195; __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.HypergraphNode.out_edges.__get__", __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_14HypergraphNode_9out_edges_2generator10(__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);
+ 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_L6_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[2]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":197
+ * def __get__(self):
+ * cdef unsigned i
+ * for i in range(self.node.out_edges_.size()): # <<<<<<<<<<<<<<
+ * yield HypergraphEdge().init(self.hg, self.node.out_edges_[i])
+ *
+ */
+ __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->node->out_edges_.size();
+ 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":198
+ * 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[2]; __pyx_lineno = 198; __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[2]; __pyx_lineno = 198; __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;
+ __pyx_t_4 = 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_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[2]; __pyx_lineno = 198; __pyx_clineno = __LINE__; 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("__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_generator->resume_label = -1;
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_14HypergraphNode_4span___get__(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":201
+ *
+ * property span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return next(self.in_edges).span
+ *
+ */
+
+static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":202
+ * property span:
+ * def __get__(self):
+ * return next(self.in_edges).span # <<<<<<<<<<<<<<
+ *
+ * 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[2]; __pyx_lineno = 202; __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[2]; __pyx_lineno = 202; __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[2]; __pyx_lineno = 202; __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;
+ __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_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("_cdec.HypergraphNode.span.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_14HypergraphNode_3cat___get__(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":205
+ *
+ * property cat:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * if self.node.cat_:
+ * return TDConvert(-self.node.cat_)
+ */
+
+static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":206
+ * property cat:
+ * def __get__(self):
+ * if self.node.cat_: # <<<<<<<<<<<<<<
+ * return TDConvert(-self.node.cat_)
+ *
+ */
+ if (__pyx_v_self->node->cat_) {
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":207
+ * def __get__(self):
+ * if self.node.cat_:
+ * return TDConvert(-self.node.cat_) # <<<<<<<<<<<<<<
+ *
+ * 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[2]; __pyx_lineno = 207; __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;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_cdec.HypergraphNode.cat.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/
+static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
+ 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[2]; __pyx_lineno = 209; __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[2]; __pyx_lineno = 209; __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:;
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":209
+ * return TDConvert(-self.node.cat_)
+ *
+ * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.node == y.node
+ */
+
+static PyObject *__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) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__richcmp__", 0);
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":212
+ * if op == 2: # ==
+ * return x.node == y.node
+ * elif op == 3: # != # <<<<<<<<<<<<<<
+ * return not (x == y)
+ * raise NotImplemented('comparison not implemented for HypergraphNode')
+ */
+ switch (__pyx_v_op) {
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":210
+ *
+ * def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
+ * if op == 2: # == # <<<<<<<<<<<<<<
+ * return x.node == y.node
+ * elif op == 3: # !=
+ */
+ case 2:
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":211
+ * def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
+ * if op == 2: # ==
+ * return x.node == y.node # <<<<<<<<<<<<<<
+ * elif op == 3: # !=
+ * 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[2]; __pyx_lineno = 211; __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":212
+ * if op == 2: # ==
+ * return x.node == y.node
+ * elif op == 3: # != # <<<<<<<<<<<<<<
+ * return not (x == y)
+ * raise NotImplemented('comparison not implemented for HypergraphNode')
+ */
+ case 3:
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":213
+ * 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[2]; __pyx_lineno = 213; __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[2]; __pyx_lineno = 213; __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[2]; __pyx_lineno = 213; __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":214
+ * 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_16), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 214; __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[2]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_cdec.HypergraphNode.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
/* Python wrapper */
static int __pyx_pw_5_cdec_7Lattice_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
@@ -5377,7 +8672,7 @@ static int __pyx_pf_5_cdec_7Lattice___init__(struct __pyx_obj_5_cdec_Lattice *__
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_inp, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_v_inp);
@@ -5408,7 +8703,7 @@ static int __pyx_pf_5_cdec_7Lattice___init__(struct __pyx_obj_5_cdec_Lattice *__
* self.lattice = new lattice.Lattice()
* lattice.ConvertTextToLattice(string(<char *>inp), self.lattice)
*/
- __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
@@ -5495,8 +8790,8 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_L
PyObject *__pyx_v_arcs = NULL;
std::vector<LatticeArc> __pyx_v_arc_vector;
LatticeArc *__pyx_v_arc;
- PyObject *__pyx_v_label = 0;
unsigned int __pyx_v_i;
+ PyObject *__pyx_v_label = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
@@ -5507,8 +8802,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_L
unsigned int __pyx_t_6;
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
- PyObject *__pyx_t_9 = NULL;
- int __pyx_t_10;
+ int __pyx_t_9;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -5536,7 +8830,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_L
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index]
*/
- __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -5562,87 +8856,92 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_L
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index] # <<<<<<<<<<<<<<
* cdef lattice.LatticeArc* arc
- * cdef str label
+ * cdef unsigned i
*/
__pyx_v_arc_vector = ((__pyx_v_self->lattice[0])[__pyx_v_index]);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":27
- * cdef str label
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":26
+ * cdef lattice.LatticeArc* arc
* cdef unsigned i
* for i in range(arc_vector.size()): # <<<<<<<<<<<<<<
* arc = &arc_vector[i]
- * label = TDConvert(arc.label)
+ * label = unicode(TDConvert(arc.label), 'utf8')
*/
__pyx_t_5 = __pyx_v_arc_vector.size();
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
__pyx_v_i = __pyx_t_6;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":28
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":27
* cdef unsigned i
* for i in range(arc_vector.size()):
* arc = &arc_vector[i] # <<<<<<<<<<<<<<
- * label = TDConvert(arc.label)
- * arcs.append((label.decode('utf8'), arc.cost, arc.dist2next))
+ * label = unicode(TDConvert(arc.label), 'utf8')
+ * arcs.append((label, arc.cost, arc.dist2next))
*/
__pyx_v_arc = (&(__pyx_v_arc_vector[__pyx_v_i]));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":29
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":28
* for i in range(arc_vector.size()):
* arc = &arc_vector[i]
- * label = TDConvert(arc.label) # <<<<<<<<<<<<<<
- * arcs.append((label.decode('utf8'), arc.cost, arc.dist2next))
+ * label = unicode(TDConvert(arc.label), 'utf8') # <<<<<<<<<<<<<<
+ * arcs.append((label, arc.cost, arc.dist2next))
* return tuple(arcs)
*/
- __pyx_t_4 = PyBytes_FromString(TD::Convert(__pyx_v_arc->label)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyBytes_FromString(TD::Convert(__pyx_v_arc->label)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
- if (!(likely(PyString_CheckExact(((PyObject *)__pyx_t_4)))||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(((PyObject *)__pyx_t_4))->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_4));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_7, 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_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
__Pyx_XDECREF(((PyObject *)__pyx_v_label));
__pyx_v_label = ((PyObject*)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":30
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":29
* arc = &arc_vector[i]
- * label = TDConvert(arc.label)
- * arcs.append((label.decode('utf8'), arc.cost, arc.dist2next)) # <<<<<<<<<<<<<<
+ * label = unicode(TDConvert(arc.label), 'utf8')
+ * arcs.append((label, arc.cost, arc.dist2next)) # <<<<<<<<<<<<<<
* return tuple(arcs)
*
*/
- __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_label), __pyx_n_s__decode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyFloat_FromDouble(__pyx_v_arc->cost); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyInt_FromLong(__pyx_v_arc->dist2next); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyFloat_FromDouble(__pyx_v_arc->cost); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_8 = PyInt_FromLong(__pyx_v_arc->dist2next); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
- __Pyx_GIVEREF(__pyx_t_7);
- PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
+ __Pyx_INCREF(((PyObject *)__pyx_v_label));
+ PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_label));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_label));
+ PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_t_7 = 0;
+ PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
__pyx_t_4 = 0;
- __pyx_t_8 = 0;
- __pyx_t_10 = PyList_Append(__pyx_v_arcs, ((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+ __pyx_t_7 = 0;
+ __pyx_t_9 = PyList_Append(__pyx_v_arcs, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":31
- * label = TDConvert(arc.label)
- * arcs.append((label.decode('utf8'), arc.cost, arc.dist2next))
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":30
+ * label = unicode(TDConvert(arc.label), 'utf8')
+ * arcs.append((label, arc.cost, arc.dist2next))
* return tuple(arcs) # <<<<<<<<<<<<<<
*
* def __setitem__(self, int index, tuple arcs):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_9 = ((PyObject *)PyList_AsTuple(__pyx_v_arcs)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_9));
- __pyx_r = ((PyObject *)__pyx_t_9);
- __pyx_t_9 = 0;
+ __pyx_t_8 = ((PyObject *)PyList_AsTuple(__pyx_v_arcs)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+ __pyx_r = ((PyObject *)__pyx_t_8);
+ __pyx_t_8 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -5651,7 +8950,6 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_2__getitem__(struct __pyx_obj_5_cdec_L
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
- __Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("_cdec.Lattice.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -5670,7 +8968,7 @@ static int __pyx_pw_5_cdec_7Lattice_5__setitem__(PyObject *__pyx_v_self, PyObjec
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
assert(__pyx_arg_index); {
- __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -5678,7 +8976,7 @@ static int __pyx_pw_5_cdec_7Lattice_5__setitem__(PyObject *__pyx_v_self, PyObjec
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arcs), (&PyTuple_Type), 1, "arcs", 1))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arcs), (&PyTuple_Type), 1, "arcs", 1))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_5_cdec_7Lattice_4__setitem__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index), ((PyObject*)__pyx_v_arcs));
goto __pyx_L0;
__pyx_L1_error:;
@@ -5688,7 +8986,7 @@ static int __pyx_pw_5_cdec_7Lattice_5__setitem__(PyObject *__pyx_v_self, PyObjec
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":33
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":32
* return tuple(arcs)
*
* def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<<
@@ -5721,7 +9019,7 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":34
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":33
*
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -5730,29 +9028,29 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice
*/
__pyx_t_1 = (0 <= __pyx_v_index);
if (__pyx_t_1) {
- __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = (__pyx_v_index < __pyx_t_2);
}
__pyx_t_3 = (!__pyx_t_1);
if (__pyx_t_3) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":35
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":34
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs:
*/
- __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":37
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":36
* raise IndexError('lattice index out of range')
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs: # <<<<<<<<<<<<<<
@@ -5760,7 +9058,7 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice
* label = label.encode('utf8')
*/
if (unlikely(((PyObject *)__pyx_v_arcs) == Py_None)) {
- PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_4 = ((PyObject *)__pyx_v_arcs); __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
for (;;) {
@@ -5772,7 +9070,7 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice
if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
@@ -5781,7 +9079,7 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice
if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_6 = PyList_GET_ITEM(sequence, 0);
__pyx_t_7 = PyList_GET_ITEM(sequence, 1);
@@ -5793,7 +9091,7 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
@@ -5803,14 +9101,14 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice
__Pyx_GOTREF(__pyx_t_7);
index = 2; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_8);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
goto __pyx_L7_unpacking_done;
__pyx_L6_unpacking_failed:;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_label);
@@ -5823,7 +9121,7 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice
__pyx_v_dist2next = __pyx_t_8;
__pyx_t_8 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":38
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":37
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs:
* if isinstance(label, unicode): # <<<<<<<<<<<<<<
@@ -5836,16 +9134,16 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_3) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":39
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":38
* for (label, cost, dist2next) in arcs:
* if isinstance(label, unicode):
* label = label.encode('utf8') # <<<<<<<<<<<<<<
* arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next)
* self.lattice[0][index].push_back(arc[0])
*/
- __pyx_t_5 = PyObject_GetAttr(__pyx_v_label, __pyx_n_s__encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_v_label, __pyx_n_s__encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_v_label);
@@ -5855,19 +9153,19 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice
}
__pyx_L8:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":40
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":39
* if isinstance(label, unicode):
* label = label.encode('utf8')
* arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next) # <<<<<<<<<<<<<<
* self.lattice[0][index].push_back(arc[0])
* del arc
*/
- __pyx_t_11 = PyBytes_AsString(__pyx_v_label); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_cost); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_dist2next); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_11 = PyBytes_AsString(__pyx_v_label); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_cost); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_dist2next); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_arc = new LatticeArc(TD::Convert(((char *)__pyx_t_11)), __pyx_t_12, __pyx_t_13);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":40
* label = label.encode('utf8')
* arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next)
* self.lattice[0][index].push_back(arc[0]) # <<<<<<<<<<<<<<
@@ -5876,7 +9174,7 @@ static int __pyx_pf_5_cdec_7Lattice_4__setitem__(struct __pyx_obj_5_cdec_Lattice
*/
((__pyx_v_self->lattice[0])[__pyx_v_index]).push_back((__pyx_v_arc[0]));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":42
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":41
* arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next)
* self.lattice[0][index].push_back(arc[0])
* del arc # <<<<<<<<<<<<<<
@@ -5917,7 +9215,7 @@ static Py_ssize_t __pyx_pw_5_cdec_7Lattice_7__len__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":44
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":43
* del arc
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -5930,7 +9228,7 @@ static Py_ssize_t __pyx_pf_5_cdec_7Lattice_6__len__(struct __pyx_obj_5_cdec_Latt
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":45
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":44
*
* def __len__(self):
* return self.lattice.size() # <<<<<<<<<<<<<<
@@ -5957,7 +9255,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_9__str__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":47
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":46
* return self.lattice.size()
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -5974,7 +9272,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_8__str__(struct __pyx_obj_5_cdec_Latti
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":48
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":47
*
* def __str__(self):
* return hypergraph.AsPLF(self.lattice[0], True).c_str() # <<<<<<<<<<<<<<
@@ -5982,7 +9280,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_8__str__(struct __pyx_obj_5_cdec_Latti
* def __iter__(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->lattice[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->lattice[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
@@ -5999,7 +9297,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_8__str__(struct __pyx_obj_5_cdec_Latti
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_7Lattice_12generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_7Lattice_12generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* Python wrapper */
static PyObject *__pyx_pw_5_cdec_7Lattice_11__iter__(PyObject *__pyx_v_self); /*proto*/
@@ -6012,7 +9310,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_11__iter__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":50
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":49
* return hypergraph.AsPLF(self.lattice[0], True).c_str()
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -6021,14 +9319,14 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_11__iter__(PyObject *__pyx_v_self) {
*/
static PyObject *__pyx_pf_5_cdec_7Lattice_10__iter__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__ *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_15___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_6___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_6___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_6___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_15___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_15___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -6038,7 +9336,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_10__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_12generator6, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Lattice_12generator11, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -6056,9 +9354,9 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_10__iter__(struct __pyx_obj_5_cdec_Lat
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_7Lattice_12generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_7Lattice_12generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__ *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_15___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_15___iter__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
Py_ssize_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -6073,27 +9371,27 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_12generator6(__pyx_GeneratorObject *__
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":52
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":51
* def __iter__(self):
* cdef unsigned i
* for i in range(len(self)): # <<<<<<<<<<<<<<
* yield self[i]
*
*/
- __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
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/lattice.pxi":53
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":52
* cdef unsigned i
* for i in range(len(self)):
* yield self[i] # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -6107,7 +9405,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_12generator6(__pyx_GeneratorObject *__
__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 = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -6130,7 +9428,7 @@ static void __pyx_pw_5_cdec_7Lattice_14__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":55
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":54
* yield self[i]
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -6142,7 +9440,7 @@ static void __pyx_pf_5_cdec_7Lattice_13__dealloc__(CYTHON_UNUSED struct __pyx_ob
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":56
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":55
*
* def __dealloc__(self):
* del self.lattice # <<<<<<<<<<<<<<
@@ -6164,7 +9462,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_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator17(__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*/
@@ -6179,7 +9477,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CY
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":59
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
*
* def todot(self):
* def lines(): # <<<<<<<<<<<<<<
@@ -6188,24 +9486,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_8_lines *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17_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_8_lines *)__pyx_ptype_5_cdec___pyx_scope_struct_8_lines->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_8_lines, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines *)__pyx_ptype_5_cdec___pyx_scope_struct_17_lines->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_17_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_7_todot *) __Pyx_CyFunction_GetClosure(__pyx_self);
+ __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_16_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_2generator9, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Lattice_5todot_2generator17, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -6223,9 +9521,9 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self) {
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
@@ -6254,86 +9552,86 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":60
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":59
* def todot(self):
* def lines():
* yield 'digraph lattice {' # <<<<<<<<<<<<<<
* yield 'rankdir = LR;'
* yield 'node [shape=circle];'
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
- __pyx_r = ((PyObject *)__pyx_kp_s_19);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
+ __pyx_r = ((PyObject *)__pyx_kp_s_23);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 1;
return __pyx_r;
__pyx_L4_resume_from_yield:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":61
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":60
* def lines():
* yield 'digraph lattice {'
* yield 'rankdir = LR;' # <<<<<<<<<<<<<<
* yield 'node [shape=circle];'
* for i in range(len(self)):
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
- __pyx_r = ((PyObject *)__pyx_kp_s_20);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_24));
+ __pyx_r = ((PyObject *)__pyx_kp_s_24);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 2;
return __pyx_r;
__pyx_L5_resume_from_yield:;
- 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 = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":62
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":61
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
* yield 'node [shape=circle];' # <<<<<<<<<<<<<<
* for i in range(len(self)):
* for label, weight, delta in self[i]:
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_21));
- __pyx_r = ((PyObject *)__pyx_kp_s_21);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
+ __pyx_r = ((PyObject *)__pyx_kp_s_25);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 3;
return __pyx_r;
__pyx_L6_resume_from_yield:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":62
* yield 'rankdir = LR;'
* yield 'node [shape=circle];'
* for i in range(len(self)): # <<<<<<<<<<<<<<
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
*/
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
__pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self);
__Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __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 = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0;
__pyx_t_4 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
@@ -6350,7 +9648,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
if (unlikely(!__pyx_t_1)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -6362,20 +9660,20 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
__pyx_cur_scope->__pyx_v_i = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":64
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63
* yield 'node [shape=circle];'
* for i in range(len(self)):
* for label, weight, delta in self[i]: # <<<<<<<<<<<<<<
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self)
*/
- __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
} else {
- __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
}
@@ -6392,7 +9690,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
if (unlikely(!__pyx_t_1)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -6404,7 +9702,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
@@ -6413,7 +9711,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_8 = PyList_GET_ITEM(sequence, 0);
__pyx_t_9 = PyList_GET_ITEM(sequence, 1);
@@ -6425,7 +9723,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
@@ -6435,14 +9733,14 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
__Pyx_GOTREF(__pyx_t_9);
index = 2; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(__pyx_t_10);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L12_unpacking_done;
__pyx_L11_unpacking_failed:;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L12_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_label);
@@ -6461,21 +9759,21 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
__pyx_cur_scope->__pyx_v_delta = __pyx_t_10;
__pyx_t_10 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":65
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":64
* for i in range(len(self)):
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) # <<<<<<<<<<<<<<
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
*/
- __pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_i, __pyx_cur_scope->__pyx_v_delta); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_i, __pyx_cur_scope->__pyx_v_delta); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_label, __pyx_n_s__replace); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_label, __pyx_n_s__replace); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
- __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_i);
PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_cur_scope->__pyx_v_i);
@@ -6486,7 +9784,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
__Pyx_GIVEREF(__pyx_t_9);
__pyx_t_1 = 0;
__pyx_t_9 = 0;
- __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_26), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_9));
__Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
__pyx_r = ((PyObject *)__pyx_t_9);
@@ -6515,13 +9813,13 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
__Pyx_XGOTREF(__pyx_t_5);
__pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
__pyx_t_7 = __pyx_cur_scope->__pyx_t_5;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":66
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":65
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self) # <<<<<<<<<<<<<<
@@ -6530,11 +9828,11 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
*/
__pyx_t_3 = ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self);
__Pyx_INCREF(__pyx_t_3);
- __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_26), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_30), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = ((PyObject *)__pyx_t_5);
@@ -6545,23 +9843,23 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
__pyx_generator->resume_label = 5;
return __pyx_r;
__pyx_L14_resume_from_yield:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":67
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":66
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self)
* yield '}' # <<<<<<<<<<<<<<
* return '\n'.join(lines()).encode('utf8')
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_27));
- __pyx_r = ((PyObject *)__pyx_kp_s_27);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
+ __pyx_r = ((PyObject *)__pyx_kp_s_31);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 6;
return __pyx_r;
__pyx_L15_resume_from_yield:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __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;}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -6580,7 +9878,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
return NULL;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
+/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":57
* del self.lattice
*
* def todot(self): # <<<<<<<<<<<<<<
@@ -6589,7 +9887,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator9(__pyx_GeneratorObje
*/
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_7_todot *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_16_todot *__pyx_cur_scope;
PyObject *__pyx_v_lines = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -6600,7 +9898,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_7_todot *)__pyx_ptype_5_cdec___pyx_scope_struct_7_todot->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_7_todot, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_16_todot *)__pyx_ptype_5_cdec___pyx_scope_struct_16_todot->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_16_todot, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -6610,41 +9908,41 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_15todot(struct __pyx_obj_5_cdec_Lattic
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
*
* def todot(self):
* def lines(): # <<<<<<<<<<<<<<
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
*/
- __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5_cdec_7Lattice_5todot_1lines, 0, ((PyObject*)__pyx_cur_scope), __pyx_n_s___cdec, ((PyObject *)__pyx_k_codeobj_29)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5_cdec_7Lattice_5todot_1lines, 0, ((PyObject*)__pyx_cur_scope), __pyx_n_s___cdec, ((PyObject *)__pyx_k_codeobj_33)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_lines = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":68
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":67
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
* return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<<
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_31), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_35), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_v_lines, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_v_lines, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __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 = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
@@ -6670,138 +9968,6 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_15todot(struct __pyx_obj_5_cdec_Lattic
/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":3
* cimport mteval
*
- * cdef char* as_str(sentence, error_msg='Cannot convert type %s to str'): # <<<<<<<<<<<<<<
- * cdef bytes ret
- * if isinstance(sentence, unicode):
- */
-
-static char *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_sentence, struct __pyx_opt_args_5_cdec_as_str *__pyx_optional_args) {
- PyObject *__pyx_v_error_msg = ((PyObject *)__pyx_kp_s_33);
- PyObject *__pyx_v_ret = 0;
- char *__pyx_r;
- __Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
- int __pyx_t_2;
- PyObject *__pyx_t_3 = NULL;
- char *__pyx_t_4;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("as_str", 0);
- if (__pyx_optional_args) {
- if (__pyx_optional_args->__pyx_n > 0) {
- __pyx_v_error_msg = __pyx_optional_args->error_msg;
- }
- }
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":5
- * cdef char* as_str(sentence, error_msg='Cannot convert type %s to str'):
- * cdef bytes ret
- * if isinstance(sentence, unicode): # <<<<<<<<<<<<<<
- * ret = sentence.encode('utf8')
- * elif isinstance(sentence, str):
- */
- __pyx_t_1 = ((PyObject *)((PyObject*)(&PyUnicode_Type)));
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_sentence, __pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_2) {
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":6
- * cdef bytes ret
- * if isinstance(sentence, unicode):
- * ret = sentence.encode('utf8') # <<<<<<<<<<<<<<
- * elif isinstance(sentence, str):
- * ret = sentence
- */
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_ret = ((PyObject*)__pyx_t_3);
- __pyx_t_3 = 0;
- goto __pyx_L3;
- }
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":7
- * if isinstance(sentence, unicode):
- * ret = sentence.encode('utf8')
- * elif isinstance(sentence, str): # <<<<<<<<<<<<<<
- * ret = sentence
- * else:
- */
- __pyx_t_3 = ((PyObject *)((PyObject*)(&PyString_Type)));
- __Pyx_INCREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_sentence, __pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_2) {
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":8
- * ret = sentence.encode('utf8')
- * elif isinstance(sentence, str):
- * ret = sentence # <<<<<<<<<<<<<<
- * else:
- * raise TypeError(error_msg % type(sentence))
- */
- if (!(likely(PyBytes_CheckExact(__pyx_v_sentence))||((__pyx_v_sentence) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_sentence)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_INCREF(__pyx_v_sentence);
- __pyx_v_ret = ((PyObject*)__pyx_v_sentence);
- goto __pyx_L3;
- }
- /*else*/ {
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":10
- * ret = sentence
- * else:
- * raise TypeError(error_msg % type(sentence)) # <<<<<<<<<<<<<<
- * return ret
- *
- */
- __pyx_t_3 = PyNumber_Remainder(__pyx_v_error_msg, ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_L3:;
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":11
- * else:
- * raise TypeError(error_msg % type(sentence))
- * return ret # <<<<<<<<<<<<<<
- *
- * cdef SufficientStats as_stats(x, y):
- */
- __pyx_t_4 = PyBytes_AsString(((PyObject *)__pyx_v_ret)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = __pyx_t_4;
- goto __pyx_L0;
-
- __pyx_r = 0;
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_3);
- __Pyx_WriteUnraisable("_cdec.as_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XDECREF(__pyx_v_ret);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":13
- * return ret
- *
* cdef SufficientStats as_stats(x, y): # <<<<<<<<<<<<<<
* if isinstance(x, SufficientStats):
* return x
@@ -6820,7 +9986,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("as_stats", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":14
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":4
*
* cdef SufficientStats as_stats(x, y):
* if isinstance(x, SufficientStats): # <<<<<<<<<<<<<<
@@ -6833,7 +9999,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":15
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":5
* cdef SufficientStats as_stats(x, y):
* if isinstance(x, SufficientStats):
* return x # <<<<<<<<<<<<<<
@@ -6841,23 +10007,23 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
* stats = SufficientStats()
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
- if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_5_cdec_SufficientStats))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_5_cdec_SufficientStats))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_INCREF(__pyx_v_x);
__pyx_r = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_x);
goto __pyx_L0;
goto __pyx_L3;
}
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":16
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":6
* if isinstance(x, SufficientStats):
* return x
* elif x == 0 and isinstance(y, SufficientStats): # <<<<<<<<<<<<<<
* stats = SufficientStats()
* stats.stats = new mteval.SufficientStats()
*/
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 6; __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[4]; __pyx_lineno = 16; __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[5]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
__pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SufficientStats));
@@ -6870,19 +10036,19 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
}
if (__pyx_t_4) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":17
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":7
* return x
* elif x == 0 and isinstance(y, SufficientStats):
* stats = SufficientStats() # <<<<<<<<<<<<<<
* stats.stats = new mteval.SufficientStats()
* stats.metric = (<SufficientStats> y).metric
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_stats = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":18
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":8
* elif x == 0 and isinstance(y, SufficientStats):
* stats = SufficientStats()
* stats.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<<
@@ -6891,7 +10057,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
*/
__pyx_v_stats->stats = new SufficientStats();
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":19
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":9
* stats = SufficientStats()
* stats.stats = new mteval.SufficientStats()
* stats.metric = (<SufficientStats> y).metric # <<<<<<<<<<<<<<
@@ -6900,7 +10066,7 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject
*/
__pyx_v_stats->metric = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_y)->metric;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":20
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":10
* stats.stats = new mteval.SufficientStats()
* stats.metric = (<SufficientStats> y).metric
* return stats # <<<<<<<<<<<<<<
@@ -6939,7 +10105,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_5words_1__get__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":27
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":17
*
* property words:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -6958,7 +10124,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_5words___get__(struct __pyx_obj_5_cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":28
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":18
* property words:
* def __get__(self):
* return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8') # <<<<<<<<<<<<<<
@@ -6966,17 +10132,17 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_5words___get__(struct __pyx_obj_5_cd
* property fmap:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(TD::GetString(__pyx_v_self->candidate->ewords).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(TD::GetString(__pyx_v_self->candidate->ewords).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __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));
__pyx_t_1 = 0;
- __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
@@ -7009,7 +10175,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":31
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":21
*
* property fmap:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -7027,19 +10193,19 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":32
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":22
* property fmap:
* def __get__(self):
* cdef SparseVector fmap = SparseVector() # <<<<<<<<<<<<<<
* fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
* return fmap
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":33
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":23
* def __get__(self):
* cdef SparseVector fmap = SparseVector()
* fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) # <<<<<<<<<<<<<<
@@ -7048,7 +10214,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde
*/
__pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_v_self->candidate->fmap);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":34
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":24
* cdef SparseVector fmap = SparseVector()
* fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
* return fmap # <<<<<<<<<<<<<<
@@ -7084,7 +10250,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_5score_1__get__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":24
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":14
* cdef class Candidate:
* cdef mteval.Candidate* candidate
* cdef public float score # <<<<<<<<<<<<<<
@@ -7101,7 +10267,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_5score___get__(struct __pyx_obj_5_cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->score); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->score); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -7138,7 +10304,7 @@ static int __pyx_pf_5_cdec_9Candidate_5score_2__set__(struct __pyx_obj_5_cdec_Ca
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->score = __pyx_t_1;
__pyx_r = 0;
@@ -7160,7 +10326,7 @@ static void __pyx_pw_5_cdec_15SufficientStats_1__dealloc__(PyObject *__pyx_v_sel
__Pyx_RefNannyFinishContext();
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":40
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":30
* cdef mteval.EvaluationMetric* metric
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -7172,7 +10338,7 @@ static void __pyx_pf_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED struct _
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":41
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":31
*
* def __dealloc__(self):
* del self.stats # <<<<<<<<<<<<<<
@@ -7195,7 +10361,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_5score_1__get__(PyObject *__p
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":44
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":34
*
* property score:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -7212,7 +10378,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_5score___get__(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":45
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":35
* property score:
* def __get__(self):
* return self.metric.ComputeScore(self.stats[0]) # <<<<<<<<<<<<<<
@@ -7220,7 +10386,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_5score___get__(struct __pyx_o
* property detail:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->metric->ComputeScore((__pyx_v_self->stats[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->metric->ComputeScore((__pyx_v_self->stats[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -7249,7 +10415,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_6detail_1__get__(PyObject *__
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":48
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":38
*
* property detail:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -7266,7 +10432,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_6detail___get__(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":49
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":39
* property detail:
* def __get__(self):
* return self.metric.DetailedScore(self.stats[0]).c_str() # <<<<<<<<<<<<<<
@@ -7274,7 +10440,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_6detail___get__(struct __pyx_
* def __len__(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(__pyx_v_self->metric->DetailedScore((__pyx_v_self->stats[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(__pyx_v_self->metric->DetailedScore((__pyx_v_self->stats[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
@@ -7303,7 +10469,7 @@ static Py_ssize_t __pyx_pw_5_cdec_15SufficientStats_3__len__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":51
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":41
* return self.metric.DetailedScore(self.stats[0]).c_str()
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -7316,7 +10482,7 @@ static Py_ssize_t __pyx_pf_5_cdec_15SufficientStats_2__len__(struct __pyx_obj_5_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":52
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":42
*
* def __len__(self):
* return self.stats.size() # <<<<<<<<<<<<<<
@@ -7331,7 +10497,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_6generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator12(__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*/
@@ -7344,7 +10510,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_5__iter__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":54
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":44
* return self.stats.size()
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -7353,14 +10519,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_9___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_9___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_9___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_9___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;
@@ -7370,7 +10536,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_6generator7, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_15SufficientStats_6generator12, (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;
@@ -7388,9 +10554,9 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_4__iter__(struct __pyx_obj_5_
return __pyx_r;
}
-static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_9___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_9___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;
PyObject *__pyx_t_2 = NULL;
@@ -7407,31 +10573,31 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator7(__pyx_GeneratorOb
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":55
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":45
*
* def __iter__(self):
* for i in range(len(self)): # <<<<<<<<<<<<<<
* yield self.stats[0][i]
*
*/
- __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
__pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
__pyx_t_4 = NULL;
} else {
- __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
@@ -7448,7 +10614,7 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator7(__pyx_GeneratorOb
if (unlikely(!__pyx_t_2)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -7460,15 +10626,15 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator7(__pyx_GeneratorOb
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":56
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":46
* def __iter__(self):
* for i in range(len(self)):
* yield self.stats[0][i] # <<<<<<<<<<<<<<
*
* def __iadd__(SufficientStats self, SufficientStats other):
*/
- __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = PyFloat_FromDouble(((__pyx_cur_scope->__pyx_v_self->stats[0])[__pyx_t_5])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyFloat_FromDouble(((__pyx_cur_scope->__pyx_v_self->stats[0])[__pyx_t_5])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
@@ -7487,7 +10653,7 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator7(__pyx_GeneratorOb
__pyx_cur_scope->__pyx_t_1 = 0;
__Pyx_XGOTREF(__pyx_t_3);
__pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
PyErr_SetNone(PyExc_StopIteration);
@@ -7509,7 +10675,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_8__iadd__(PyObject *__pyx_v_s
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_5_cdec_SufficientStats, 1, "other", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_5_cdec_SufficientStats, 1, "other", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_5_cdec_15SufficientStats_7__iadd__(((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_self), ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_other));
goto __pyx_L0;
__pyx_L1_error:;
@@ -7519,7 +10685,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_8__iadd__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":58
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":48
* yield self.stats[0][i]
*
* def __iadd__(SufficientStats self, SufficientStats other): # <<<<<<<<<<<<<<
@@ -7532,7 +10698,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__iadd__(struct __pyx_obj_5_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iadd__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":49
*
* def __iadd__(SufficientStats self, SufficientStats other):
* self.stats[0] += other.stats[0] # <<<<<<<<<<<<<<
@@ -7541,7 +10707,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__iadd__(struct __pyx_obj_5_
*/
(__pyx_v_self->stats[0]) += (__pyx_v_other->stats[0]);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":60
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":50
* def __iadd__(SufficientStats self, SufficientStats other):
* self.stats[0] += other.stats[0]
* return self # <<<<<<<<<<<<<<
@@ -7571,7 +10737,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_10__add__(PyObject *__pyx_v_x
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":62
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":52
* return self
*
* def __add__(x, y): # <<<<<<<<<<<<<<
@@ -7591,43 +10757,43 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_9__add__(PyObject *__pyx_v_x,
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__add__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":63
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":53
*
* def __add__(x, y):
* cdef SufficientStats sx = as_stats(x, y) # <<<<<<<<<<<<<<
* cdef SufficientStats sy = as_stats(y, x)
* cdef SufficientStats result = SufficientStats()
*/
- __pyx_t_1 = ((PyObject *)__pyx_f_5_cdec_as_stats(__pyx_v_x, __pyx_v_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((PyObject *)__pyx_f_5_cdec_as_stats(__pyx_v_x, __pyx_v_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_sx = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":64
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":54
* def __add__(x, y):
* cdef SufficientStats sx = as_stats(x, y)
* cdef SufficientStats sy = as_stats(y, x) # <<<<<<<<<<<<<<
* cdef SufficientStats result = SufficientStats()
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
*/
- __pyx_t_1 = ((PyObject *)__pyx_f_5_cdec_as_stats(__pyx_v_y, __pyx_v_x)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((PyObject *)__pyx_f_5_cdec_as_stats(__pyx_v_y, __pyx_v_x)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_sy = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":65
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":55
* cdef SufficientStats sx = as_stats(x, y)
* cdef SufficientStats sy = as_stats(y, x)
* cdef SufficientStats result = SufficientStats() # <<<<<<<<<<<<<<
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
* result.metric = sx.metric
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_result = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":66
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":56
* cdef SufficientStats sy = as_stats(y, x)
* cdef SufficientStats result = SufficientStats()
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) # <<<<<<<<<<<<<<
@@ -7636,7 +10802,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_9__add__(PyObject *__pyx_v_x,
*/
__pyx_v_result->stats = new SufficientStats(operator+((__pyx_v_sx->stats[0]), (__pyx_v_sy->stats[0])));
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":67
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":57
* cdef SufficientStats result = SufficientStats()
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
* result.metric = sx.metric # <<<<<<<<<<<<<<
@@ -7645,7 +10811,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_9__add__(PyObject *__pyx_v_x,
*/
__pyx_v_result->metric = __pyx_v_sx->metric;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":68
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":58
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
* result.metric = sx.metric
* return result # <<<<<<<<<<<<<<
@@ -7698,7 +10864,7 @@ static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyO
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
@@ -7709,13 +10875,13 @@ static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyO
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_cdec.CandidateSet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_evaluator), __pyx_ptype_5_cdec_SegmentEvaluator, 1, "evaluator", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_evaluator), __pyx_ptype_5_cdec_SegmentEvaluator, 1, "evaluator", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_5_cdec_12CandidateSet___cinit__(((struct __pyx_obj_5_cdec_CandidateSet *)__pyx_v_self), __pyx_v_evaluator);
goto __pyx_L0;
__pyx_L1_error:;
@@ -7725,7 +10891,7 @@ static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyO
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":75
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":65
* cdef mteval.CandidateSet* cs
*
* def __cinit__(self, SegmentEvaluator evaluator): # <<<<<<<<<<<<<<
@@ -7738,7 +10904,7 @@ static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_Cand
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":76
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":66
*
* def __cinit__(self, SegmentEvaluator evaluator):
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) # <<<<<<<<<<<<<<
@@ -7747,7 +10913,7 @@ static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_Cand
*/
__pyx_v_self->scorer = new boost::shared_ptr<SegmentEvaluator>((__pyx_v_evaluator->scorer[0]));
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":77
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":67
* def __cinit__(self, SegmentEvaluator evaluator):
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
* self.metric = evaluator.metric # <<<<<<<<<<<<<<
@@ -7756,7 +10922,7 @@ static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_Cand
*/
__pyx_v_self->metric = __pyx_v_evaluator->metric;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":78
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":68
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
* self.metric = evaluator.metric
* self.cs = new mteval.CandidateSet() # <<<<<<<<<<<<<<
@@ -7779,7 +10945,7 @@ static void __pyx_pw_5_cdec_12CandidateSet_3__dealloc__(PyObject *__pyx_v_self)
__Pyx_RefNannyFinishContext();
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":80
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":70
* self.cs = new mteval.CandidateSet()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -7791,7 +10957,7 @@ static void __pyx_pf_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":81
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":71
*
* def __dealloc__(self):
* del self.scorer # <<<<<<<<<<<<<<
@@ -7800,7 +10966,7 @@ static void __pyx_pf_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __p
*/
delete __pyx_v_self->scorer;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":82
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":72
* def __dealloc__(self):
* del self.scorer
* del self.cs # <<<<<<<<<<<<<<
@@ -7823,7 +10989,7 @@ static Py_ssize_t __pyx_pw_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":84
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":74
* del self.cs
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -7836,7 +11002,7 @@ static Py_ssize_t __pyx_pf_5_cdec_12CandidateSet_4__len__(struct __pyx_obj_5_cde
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":85
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":75
*
* def __len__(self):
* return self.cs.size() # <<<<<<<<<<<<<<
@@ -7860,7 +11026,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_s
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
assert(__pyx_arg_k); {
- __pyx_v_k = __Pyx_PyInt_AsInt(__pyx_arg_k); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_k = __Pyx_PyInt_AsInt(__pyx_arg_k); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -7873,7 +11039,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":87
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":77
* return self.cs.size()
*
* def __getitem__(self,int k): # <<<<<<<<<<<<<<
@@ -7893,7 +11059,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":88
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":78
*
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size(): # <<<<<<<<<<<<<<
@@ -7907,35 +11073,35 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
__pyx_t_2 = (!__pyx_t_1);
if (__pyx_t_2) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":89
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":79
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<<
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k]
*/
- __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[4]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":90
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":80
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range')
* cdef Candidate candidate = Candidate() # <<<<<<<<<<<<<<
* candidate.candidate = &self.cs[0][k]
* candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats)
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Candidate)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Candidate)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_candidate = ((struct __pyx_obj_5_cdec_Candidate *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":91
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":81
* raise IndexError('candidate set index out of range')
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k] # <<<<<<<<<<<<<<
@@ -7944,7 +11110,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
*/
__pyx_v_candidate->candidate = (&((__pyx_v_self->cs[0])[__pyx_v_k]));
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":92
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":82
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k]
* candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats) # <<<<<<<<<<<<<<
@@ -7953,7 +11119,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_
*/
__pyx_v_candidate->score = __pyx_v_self->metric->ComputeScore(((__pyx_v_self->cs[0])[__pyx_v_k]).eval_feats);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":93
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":83
* candidate.candidate = &self.cs[0][k]
* candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats)
* return candidate # <<<<<<<<<<<<<<
@@ -7977,7 +11143,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_10generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator13(__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*/
@@ -7990,7 +11156,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":95
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":85
* return candidate
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -7999,14 +11165,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_10___iter__ *__pyx_cur_scope;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19___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_10___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_10___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_10___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_19___iter__ *)__pyx_ptype_5_cdec___pyx_scope_struct_19___iter__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_19___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -8016,7 +11182,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_10generator8, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_12CandidateSet_10generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -8034,9 +11200,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_10generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__ *)__pyx_generator->closure);
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19___iter__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
Py_ssize_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -8051,27 +11217,27 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator8(__pyx_GeneratorObje
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":97
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":87
* def __iter__(self):
* cdef unsigned i
* for i in range(len(self)): # <<<<<<<<<<<<<<
* yield self[i]
*
*/
- __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
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/mteval.pxi":98
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":88
* cdef unsigned i
* for i in range(len(self)):
* yield self[i] # <<<<<<<<<<<<<<
*
* def add_kbest(self, Hypergraph hypergraph, unsigned k):
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -8085,7 +11251,7 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator8(__pyx_GeneratorObje
__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[4]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
@@ -8129,11 +11295,11 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_se
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_kbest") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_kbest") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
@@ -8142,17 +11308,17 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_se
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_hypergraph = ((struct __pyx_obj_5_cdec_Hypergraph *)values[0]);
- __pyx_v_k = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_k == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_k = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_k == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_cdec.CandidateSet.add_kbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hypergraph), __pyx_ptype_5_cdec_Hypergraph, 1, "hypergraph", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hypergraph), __pyx_ptype_5_cdec_Hypergraph, 1, "hypergraph", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_5_cdec_12CandidateSet_11add_kbest(((struct __pyx_obj_5_cdec_CandidateSet *)__pyx_v_self), __pyx_v_hypergraph, __pyx_v_k);
goto __pyx_L0;
__pyx_L1_error:;
@@ -8162,7 +11328,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":100
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":90
* yield self[i]
*
* def add_kbest(self, Hypergraph hypergraph, unsigned k): # <<<<<<<<<<<<<<
@@ -8175,7 +11341,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_11add_kbest(struct __pyx_obj_5_c
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("add_kbest", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":101
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":91
*
* def add_kbest(self, Hypergraph hypergraph, unsigned k):
* self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get()) # <<<<<<<<<<<<<<
@@ -8199,7 +11365,7 @@ static void __pyx_pw_5_cdec_16SegmentEvaluator_1__dealloc__(PyObject *__pyx_v_se
__Pyx_RefNannyFinishContext();
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":107
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":97
* cdef mteval.EvaluationMetric* metric
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -8211,7 +11377,7 @@ static void __pyx_pf_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED struct
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":108
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":98
*
* def __dealloc__(self):
* del self.scorer # <<<<<<<<<<<<<<
@@ -8234,7 +11400,7 @@ static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_3evaluate(PyObject *__pyx_v_
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":110
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":100
* del self.scorer
*
* def evaluate(self, sentence): # <<<<<<<<<<<<<<
@@ -8254,19 +11420,19 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("evaluate", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":112
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":102
* def evaluate(self, sentence):
* cdef vector[WordID] hyp
* cdef SufficientStats sf = SufficientStats() # <<<<<<<<<<<<<<
* sf.metric = self.metric
* sf.stats = new mteval.SufficientStats()
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_sf = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":113
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":103
* cdef vector[WordID] hyp
* cdef SufficientStats sf = SufficientStats()
* sf.metric = self.metric # <<<<<<<<<<<<<<
@@ -8275,7 +11441,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
*/
__pyx_v_sf->metric = __pyx_v_self->metric;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":114
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":104
* cdef SufficientStats sf = SufficientStats()
* sf.metric = self.metric
* sf.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<<
@@ -8284,22 +11450,22 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
*/
__pyx_v_sf->stats = new SufficientStats();
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":115
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":105
* sf.metric = self.metric
* sf.stats = new mteval.SufficientStats()
* ConvertSentence(string(as_str(sentence.strip())), &hyp) # <<<<<<<<<<<<<<
* self.scorer.get().Evaluate(hyp, sf.stats)
* return sf
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 115; __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[5]; __pyx_lineno = 105; __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[4]; __pyx_lineno = 115; __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[5]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
TD::ConvertSentence(std::string(__pyx_f_5_cdec_as_str(__pyx_t_2, NULL)), (&__pyx_v_hyp));
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":116
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":106
* sf.stats = new mteval.SufficientStats()
* ConvertSentence(string(as_str(sentence.strip())), &hyp)
* self.scorer.get().Evaluate(hyp, sf.stats) # <<<<<<<<<<<<<<
@@ -8308,7 +11474,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5
*/
__pyx_v_self->scorer->get()->Evaluate(__pyx_v_hyp, __pyx_v_sf->stats);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":117
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":107
* ConvertSentence(string(as_str(sentence.strip())), &hyp)
* self.scorer.get().Evaluate(hyp, sf.stats)
* return sf # <<<<<<<<<<<<<<
@@ -8345,7 +11511,7 @@ static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_5candidate_set(PyObject *__p
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":119
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":109
* return sf
*
* def candidate_set(self): # <<<<<<<<<<<<<<
@@ -8363,7 +11529,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("candidate_set", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":120
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":110
*
* def candidate_set(self):
* return CandidateSet(self) # <<<<<<<<<<<<<<
@@ -8371,12 +11537,12 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_
* cdef class Scorer:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_CandidateSet)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_CandidateSet)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
@@ -8422,18 +11588,18 @@ static int __pyx_pw_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject *
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
}
- __pyx_v_name = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_name) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_name = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_name) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_cdec.Scorer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -8444,7 +11610,7 @@ static int __pyx_pw_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":125
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":115
* cdef string* name
*
* def __cinit__(self, char* name): # <<<<<<<<<<<<<<
@@ -8457,7 +11623,7 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":126
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":116
*
* def __cinit__(self, char* name):
* self.name = new string(name) # <<<<<<<<<<<<<<
@@ -8480,7 +11646,7 @@ static void __pyx_pw_5_cdec_6Scorer_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":128
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":118
* self.name = new string(name)
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -8492,7 +11658,7 @@ static void __pyx_pf_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":129
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":119
*
* def __dealloc__(self):
* del self.name # <<<<<<<<<<<<<<
@@ -8530,7 +11696,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObj
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
@@ -8541,7 +11707,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObj
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_cdec.Scorer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -8552,7 +11718,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":131
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":121
* del self.name
*
* def __call__(self, refs): # <<<<<<<<<<<<<<
@@ -8582,7 +11748,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
__Pyx_RefNannySetupContext("__call__", 0);
__Pyx_INCREF(__pyx_v_refs);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":132
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":122
*
* def __call__(self, refs):
* cdef mteval.EvaluationMetric* metric = mteval.Instance(self.name[0]) # <<<<<<<<<<<<<<
@@ -8591,7 +11757,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
__pyx_v_metric = EvaluationMetric::Instance((__pyx_v_self->name[0]));
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":133
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":123
* def __call__(self, refs):
* cdef mteval.EvaluationMetric* metric = mteval.Instance(self.name[0])
* if isinstance(refs, unicode) or isinstance(refs, str): # <<<<<<<<<<<<<<
@@ -8613,14 +11779,14 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
}
if (__pyx_t_4) {
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":134
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":124
* cdef mteval.EvaluationMetric* metric = mteval.Instance(self.name[0])
* if isinstance(refs, unicode) or isinstance(refs, str):
* refs = [refs] # <<<<<<<<<<<<<<
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]()
* cdef vector[WordID]* refv
*/
- __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_refs);
PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_refs);
@@ -8632,7 +11798,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
}
__pyx_L3:;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":135
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":125
* if isinstance(refs, unicode) or isinstance(refs, str):
* refs = [refs]
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() # <<<<<<<<<<<<<<
@@ -8641,7 +11807,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
__pyx_v_refsv = new std::vector<std::vector<WordID> >();
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":138
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":128
* cdef vector[WordID]* refv
* cdef bytes ref_str
* for ref in refs: # <<<<<<<<<<<<<<
@@ -8652,7 +11818,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
__pyx_t_1 = __pyx_v_refs; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
__pyx_t_6 = NULL;
} else {
- __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_refs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_refs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -8668,7 +11834,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
if (unlikely(!__pyx_t_7)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -8678,7 +11844,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
__pyx_v_ref = __pyx_t_7;
__pyx_t_7 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":139
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":129
* cdef bytes ref_str
* for ref in refs:
* refv = new vector[WordID]() # <<<<<<<<<<<<<<
@@ -8687,22 +11853,22 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
__pyx_v_refv = new std::vector<WordID>();
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":140
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":130
* for ref in refs:
* refv = new vector[WordID]()
* ConvertSentence(string(as_str(ref.strip())), refv) # <<<<<<<<<<<<<<
* refsv.push_back(refv[0])
* del refv
*/
- __pyx_t_7 = PyObject_GetAttr(__pyx_v_ref, __pyx_n_s__strip); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_GetAttr(__pyx_v_ref, __pyx_n_s__strip); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
TD::ConvertSentence(std::string(__pyx_f_5_cdec_as_str(__pyx_t_8, NULL)), __pyx_v_refv);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":141
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":131
* refv = new vector[WordID]()
* ConvertSentence(string(as_str(ref.strip())), refv)
* refsv.push_back(refv[0]) # <<<<<<<<<<<<<<
@@ -8711,7 +11877,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
__pyx_v_refsv->push_back((__pyx_v_refv[0]));
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":142
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":132
* ConvertSentence(string(as_str(ref.strip())), refv)
* refsv.push_back(refv[0])
* del refv # <<<<<<<<<<<<<<
@@ -8722,19 +11888,19 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":144
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":134
* del refv
* cdef unsigned i
* cdef SegmentEvaluator evaluator = SegmentEvaluator() # <<<<<<<<<<<<<<
* evaluator.metric = metric
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator](metric.CreateSegmentEvaluator(refsv[0]))
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SegmentEvaluator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SegmentEvaluator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_evaluator = ((struct __pyx_obj_5_cdec_SegmentEvaluator *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":145
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":135
* cdef unsigned i
* cdef SegmentEvaluator evaluator = SegmentEvaluator()
* evaluator.metric = metric # <<<<<<<<<<<<<<
@@ -8743,7 +11909,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
__pyx_v_evaluator->metric = __pyx_v_metric;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":146
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":136
* cdef SegmentEvaluator evaluator = SegmentEvaluator()
* evaluator.metric = metric
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator](metric.CreateSegmentEvaluator(refsv[0])) # <<<<<<<<<<<<<<
@@ -8752,7 +11918,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
__pyx_v_evaluator->scorer = new boost::shared_ptr<SegmentEvaluator>(__pyx_v_metric->CreateSegmentEvaluator((__pyx_v_refsv[0])));
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":147
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":137
* evaluator.metric = metric
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator](metric.CreateSegmentEvaluator(refsv[0]))
* del refsv # in theory should not delete but store in SegmentEvaluator # <<<<<<<<<<<<<<
@@ -8761,7 +11927,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score
*/
delete __pyx_v_refsv;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":148
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":138
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator](metric.CreateSegmentEvaluator(refsv[0]))
* del refsv # in theory should not delete but store in SegmentEvaluator
* return evaluator # <<<<<<<<<<<<<<
@@ -8801,7 +11967,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self) {
return __pyx_r;
}
-/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":150
+/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":140
* return evaluator
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -8818,7 +11984,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":151
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":141
*
* def __str__(self):
* return self.name.c_str() # <<<<<<<<<<<<<<
@@ -8826,7 +11992,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer
* BLEU = Scorer('IBM_BLEU')
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyBytes_FromString(__pyx_v_self->name->c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyBytes_FromString(__pyx_v_self->name->c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
@@ -8843,17 +12009,534 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+static PyObject *__pyx_gb_5_cdec_4generator14(__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) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("_make_config (wrapper)", 0);
+ __pyx_self = __pyx_self;
+ __pyx_r = __pyx_pf_5_cdec_2_make_config(__pyx_self, ((PyObject *)__pyx_v_config));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_cdec.pyx":27
+ * class ParseFailed(Exception): pass
+ *
+ * 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_20__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_20__make_config *)__pyx_ptype_5_cdec___pyx_scope_struct_20__make_config->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_20__make_config, __pyx_empty_tuple, NULL);
+ if (unlikely(!__pyx_cur_scope)) {
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ }
+ __Pyx_GOTREF(__pyx_cur_scope);
+ __pyx_cur_scope->__pyx_v_config = __pyx_v_config;
+ __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_4generator14, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __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._make_config", __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_4generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+{
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20__make_config *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_20__make_config *)__pyx_generator->closure);
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ Py_ssize_t __pyx_t_3;
+ PyObject *(*__pyx_t_4)(PyObject *);
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *(*__pyx_t_8)(PyObject *);
+ int __pyx_t_9;
+ Py_ssize_t __pyx_t_10;
+ PyObject *(*__pyx_t_11)(PyObject *);
+ PyObject *__pyx_t_12 = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("None", 0);
+ switch (__pyx_generator->resume_label) {
+ case 0: goto __pyx_L3_first_run;
+ case 1: goto __pyx_L13_resume_from_yield;
+ case 2: goto __pyx_L16_resume_from_yield;
+ case 3: goto __pyx_L17_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[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "_cdec.pyx":28
+ *
+ * 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 = 28; __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 = 28; __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 = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ for (;;) {
+ if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
+ if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
+ } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
+ if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
+ } 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 = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ }
+ if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
+ PyObject* sequence = __pyx_t_2;
+ if (likely(PyTuple_CheckExact(sequence))) {
+ if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+ if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+ else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
+ } else {
+ if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+ if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+ else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
+ }
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __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 = 28; __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;
+ index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_5);
+ index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L7_unpacking_done;
+ __pyx_L6_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
+ if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_L7_unpacking_done:;
+ }
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
+ __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_key);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_cur_scope->__pyx_v_key = __pyx_t_5;
+ __pyx_t_5 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value);
+ __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_value);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_cur_scope->__pyx_v_value = __pyx_t_6;
+ __pyx_t_6 = 0;
+
+ /* "_cdec.pyx":29
+ * def _make_config(config):
+ * for key, value in config.items():
+ * if isinstance(value, dict): # <<<<<<<<<<<<<<
+ * for name, info in value.items():
+ * yield key, '%s %s' % (name, info)
+ */
+ __pyx_t_2 = ((PyObject *)((PyObject*)(&PyDict_Type)));
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_t_9 = __Pyx_TypeCheck(__pyx_cur_scope->__pyx_v_value, __pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_9) {
+
+ /* "_cdec.pyx":30
+ * 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 = 30; __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 = 30; __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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ for (;;) {
+ if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++;
+ } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++;
+ } 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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_6);
+ }
+ if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
+ PyObject* sequence = __pyx_t_6;
+ if (likely(PyTuple_CheckExact(sequence))) {
+ if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+ if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+ else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
+ } else {
+ if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+ if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+ else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
+ }
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_7);
+ __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 = 30; __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;
+ index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_12); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
+ __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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ goto __pyx_L12_unpacking_done;
+ __pyx_L11_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
+ if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_L12_unpacking_done:;
+ }
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_name);
+ __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_name);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_cur_scope->__pyx_v_name = __pyx_t_5;
+ __pyx_t_5 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_info);
+ __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_info);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_cur_scope->__pyx_v_info = __pyx_t_7;
+ __pyx_t_7 = 0;
+
+ /* "_cdec.pyx":31
+ * 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 = 31; __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);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_name);
+ __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_39), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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 = 31; __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);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_t_7));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
+ __pyx_t_7 = 0;
+ __pyx_r = ((PyObject *)__pyx_t_6);
+ __pyx_t_6 = 0;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
+ __pyx_cur_scope->__pyx_t_3 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_4 = __pyx_t_10;
+ __pyx_cur_scope->__pyx_t_5 = __pyx_t_11;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ /* return from generator, yielding value */
+ __pyx_generator->resume_label = 1;
+ return __pyx_r;
+ __pyx_L13_resume_from_yield:;
+ __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_cur_scope->__pyx_t_0 = 0;
+ __Pyx_XGOTREF(__pyx_t_1);
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_cur_scope->__pyx_t_1 = 0;
+ __Pyx_XGOTREF(__pyx_t_2);
+ __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
+ __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 = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ goto __pyx_L8;
+ }
+
+ /* "_cdec.pyx":32
+ * for name, info in value.items():
+ * yield key, '%s %s' % (name, info)
+ * elif isinstance(value, list): # <<<<<<<<<<<<<<
+ * for name in value:
+ * yield key, name
+ */
+ __pyx_t_2 = ((PyObject *)((PyObject*)(&PyList_Type)));
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_t_9 = __Pyx_TypeCheck(__pyx_cur_scope->__pyx_v_value, __pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_9) {
+
+ /* "_cdec.pyx":33
+ * yield key, '%s %s' % (name, info)
+ * elif isinstance(value, list):
+ * for name in value: # <<<<<<<<<<<<<<
+ * yield key, name
+ * else:
+ */
+ if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_value) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_value)) {
+ __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 = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ }
+ for (;;) {
+ if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++;
+ } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++;
+ } 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 = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_6);
+ }
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_name);
+ __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_name);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_cur_scope->__pyx_v_name = __pyx_t_6;
+ __pyx_t_6 = 0;
+
+ /* "_cdec.pyx":34
+ * 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 = 34; __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);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_name);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_cur_scope->__pyx_v_name);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_name);
+ __pyx_r = ((PyObject *)__pyx_t_6);
+ __pyx_t_6 = 0;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
+ __pyx_cur_scope->__pyx_t_3 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_4 = __pyx_t_10;
+ __pyx_cur_scope->__pyx_t_5 = __pyx_t_11;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ /* return from generator, yielding value */
+ __pyx_generator->resume_label = 2;
+ return __pyx_r;
+ __pyx_L16_resume_from_yield:;
+ __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_cur_scope->__pyx_t_0 = 0;
+ __Pyx_XGOTREF(__pyx_t_1);
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_cur_scope->__pyx_t_1 = 0;
+ __Pyx_XGOTREF(__pyx_t_2);
+ __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
+ __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 = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ goto __pyx_L8;
+ }
+ /*else*/ {
+
+ /* "_cdec.pyx":36
+ * 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 = 36; __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 = 36; __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 = 36; __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);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_r = ((PyObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
+ __pyx_cur_scope->__pyx_t_3 = __pyx_t_4;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ /* return from generator, yielding value */
+ __pyx_generator->resume_label = 3;
+ return __pyx_r;
+ __pyx_L17_resume_from_yield:;
+ __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_cur_scope->__pyx_t_0 = 0;
+ __Pyx_XGOTREF(__pyx_t_1);
+ __pyx_t_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 = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_L8:;
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ PyErr_SetNone(PyExc_StopIteration);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_12);
+ __Pyx_AddTraceback("_make_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_generator->resume_label = -1;
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+}
/* Python wrapper */
static int __pyx_pw_5_cdec_7Decoder_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5_cdec_7Decoder_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- char *__pyx_v_config;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__config,0};
+ PyObject *__pyx_v_config_str = 0;
+ PyObject *__pyx_v_config = 0;
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__config_str,0};
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+ __pyx_v_config = PyDict_New(); if (unlikely(!__pyx_v_config)) return -1;
+ __Pyx_GOTREF(__pyx_v_config);
{
PyObject* values[1] = {0};
+
+ /* "_cdec.pyx":42
+ * cdef DenseVector weights
+ *
+ * def __cinit__(self, config_str=None, **config): # <<<<<<<<<<<<<<
+ * """ Configuration can be given as a string:
+ * Decoder('formalism = scfg')
+ */
+ values[0] = ((PyObject *)Py_None);
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
@@ -8865,80 +12548,369 @@ static int __pyx_pw_5_cdec_7Decoder_1__cinit__(PyObject *__pyx_v_self, PyObject
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__config);
- if (likely(values[0])) kw_args--;
- else goto __pyx_L5_argtuple_error;
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__config_str);
+ if (value) { values[0] = value; kw_args--; }
+ }
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __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 = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
- } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
- goto __pyx_L5_argtuple_error;
} else {
- values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
}
- __pyx_v_config = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_config) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_config_str = values[0];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __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 = 42; __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);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_5_cdec_7Decoder___cinit__(((struct __pyx_obj_5_cdec_Decoder *)__pyx_v_self), __pyx_v_config);
+ __pyx_r = __pyx_pf_5_cdec_7Decoder___cinit__(((struct __pyx_obj_5_cdec_Decoder *)__pyx_v_self), __pyx_v_config_str, __pyx_v_config);
+ __Pyx_XDECREF(__pyx_v_config);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "_cdec.pyx":19
+/* "_cdec.pyx":53
+ * '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)
+ */
+
+static PyObject *__pyx_pf_5_cdec_7Decoder_9__cinit___genexpr(PyObject *__pyx_self) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22_genexpr *__pyx_cur_scope;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("genexpr", 0);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_22_genexpr *)__pyx_ptype_5_cdec___pyx_scope_struct_22_genexpr->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_22_genexpr, __pyx_empty_tuple, NULL);
+ if (unlikely(!__pyx_cur_scope)) {
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ }
+ __Pyx_GOTREF(__pyx_cur_scope);
+ __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___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___2generator18, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __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.Decoder.__cinit__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_gb_5_cdec_7Decoder_9__cinit___2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+{
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_22_genexpr *)__pyx_generator->closure);
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ Py_ssize_t __pyx_t_4;
+ PyObject *(*__pyx_t_5)(PyObject *);
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("None", 0);
+ switch (__pyx_generator->resume_label) {
+ case 0: goto __pyx_L3_first_run;
+ case 1: goto __pyx_L6_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[0]; __pyx_lineno = 53; __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 = 53; __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 = 53; __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 = 53; __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 = 53; __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;
+ if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
+ __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 = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ for (;;) {
+ if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
+ } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) {
+ if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
+ } 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 = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_3);
+ }
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_kv);
+ __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_kv);
+ __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_40), __pyx_cur_scope->__pyx_v_kv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __pyx_r = ((PyObject *)__pyx_t_3);
+ __pyx_t_3 = 0;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ /* return from generator, yielding value */
+ __pyx_generator->resume_label = 1;
+ return __pyx_r;
+ __pyx_L6_resume_from_yield:;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_cur_scope->__pyx_t_0 = 0;
+ __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 = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ PyErr_SetNone(PyExc_StopIteration);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_generator->resume_label = -1;
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+}
+
+/* "_cdec.pyx":42
* cdef DenseVector weights
*
- * def __cinit__(self, char* config): # <<<<<<<<<<<<<<
- * decoder.register_feature_functions()
- * cdef istringstream* config_stream = new istringstream(config)
+ * def __cinit__(self, config_str=None, **config): # <<<<<<<<<<<<<<
+ * """ Configuration can be given as a string:
+ * Decoder('formalism = scfg')
*/
-static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, char *__pyx_v_config) {
+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_21___cinit__ *__pyx_cur_scope;
+ PyObject *__pyx_v_formalism = NULL;
std::istringstream *__pyx_v_config_stream;
int __pyx_r;
__Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ int __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ char *__pyx_t_7;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
+ __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___cinit__ *)__pyx_ptype_5_cdec___pyx_scope_struct_21___cinit__->tp_new(__pyx_ptype_5_cdec___pyx_scope_struct_21___cinit__, __pyx_empty_tuple, NULL);
+ if (unlikely(!__pyx_cur_scope)) {
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ }
+ __Pyx_GOTREF(__pyx_cur_scope);
+ __pyx_cur_scope->__pyx_v_config = __pyx_v_config;
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_config);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_config);
+ __Pyx_INCREF(__pyx_v_config_str);
+
+ /* "_cdec.pyx":48
+ * Decoder(formalism='scfg')
+ * """
+ * if config_str is None: # <<<<<<<<<<<<<<
+ * formalism = config.get('formalism', None)
+ * if formalism not in ('scfg', 'fst', 'lextrans', 'pb',
+ */
+ __pyx_t_1 = (__pyx_v_config_str == Py_None);
+ if (__pyx_t_1) {
- /* "_cdec.pyx":20
- *
- * def __cinit__(self, char* config):
- * decoder.register_feature_functions() # <<<<<<<<<<<<<<
- * cdef istringstream* config_stream = new istringstream(config)
+ /* "_cdec.pyx":49
+ * """
+ * 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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __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":50
+ * if config_str is None:
+ * formalism = config.get('formalism', None)
+ * if formalism not in ('scfg', 'fst', 'lextrans', 'pb', # <<<<<<<<<<<<<<
+ * 'csplit', 'tagger', 'lexalign'):
+ * raise InvalidConfig('formalism "%s" unknown' % formalism)
+ */
+ __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 = 50; __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 = 50; __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 = 50; __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 = 50; __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 = 50; __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 = 50; __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 = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((int)__pyx_t_5);
+ } else {
+ __pyx_t_1 = __pyx_t_4;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = __pyx_t_1;
+ if (__pyx_t_4) {
+
+ /* "_cdec.pyx":52
+ * 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 = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_v_formalism); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __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 = 52; __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 = 52; __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 = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "_cdec.pyx":53
+ * '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)
*/
- register_feature_functions();
+ __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_35), __pyx_n_s__join); 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_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 = 53; __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 = 53; __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 = 53; __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;
+ __Pyx_DECREF(__pyx_v_config_str);
+ __pyx_v_config_str = __pyx_t_6;
+ __pyx_t_6 = 0;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
- /* "_cdec.pyx":21
- * def __cinit__(self, char* config):
- * decoder.register_feature_functions()
- * cdef istringstream* config_stream = new istringstream(config) # <<<<<<<<<<<<<<
+ /* "_cdec.pyx":54
+ * 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_v_config_stream = new std::istringstream(__pyx_v_config);
+ __pyx_t_7 = PyBytes_AsString(__pyx_v_config_str); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_config_stream = new std::istringstream(__pyx_t_7);
- /* "_cdec.pyx":22
- * decoder.register_feature_functions()
- * cdef istringstream* config_stream = new istringstream(config)
+ /* "_cdec.pyx":55
+ * 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
* self.weights = DenseVector()
*/
__pyx_v_self->dec = new Decoder(__pyx_v_config_stream);
- /* "_cdec.pyx":23
- * cdef istringstream* config_stream = new istringstream(config)
+ /* "_cdec.pyx":56
+ * cdef istringstream* config_stream = new istringstream(config_str)
* self.dec = new decoder.Decoder(config_stream)
* del config_stream # <<<<<<<<<<<<<<
* self.weights = DenseVector()
@@ -8946,22 +12918,22 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
*/
delete __pyx_v_config_stream;
- /* "_cdec.pyx":24
+ /* "_cdec.pyx":57
* self.dec = new decoder.Decoder(config_stream)
* del config_stream
* self.weights = DenseVector() # <<<<<<<<<<<<<<
* self.weights.vector = &self.dec.CurrentWeightVector()
*
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_DenseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_DenseVector)), ((PyObject *)__pyx_empty_tuple), 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_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_1);
- __pyx_t_1 = 0;
+ __pyx_v_self->weights = ((struct __pyx_obj_5_cdec_DenseVector *)__pyx_t_6);
+ __pyx_t_6 = 0;
- /* "_cdec.pyx":25
+ /* "_cdec.pyx":58
* del config_stream
* self.weights = DenseVector()
* self.weights.vector = &self.dec.CurrentWeightVector() # <<<<<<<<<<<<<<
@@ -8973,10 +12945,15 @@ static int __pyx_pf_5_cdec_7Decoder___cinit__(struct __pyx_obj_5_cdec_Decoder *_
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("_cdec.Decoder.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_formalism);
+ __Pyx_XDECREF(__pyx_v_config_str);
+ __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -8990,7 +12967,7 @@ static void __pyx_pw_5_cdec_7Decoder_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyFinishContext();
}
-/* "_cdec.pyx":27
+/* "_cdec.pyx":60
* self.weights.vector = &self.dec.CurrentWeightVector()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -9002,7 +12979,7 @@ static void __pyx_pf_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __pyx_obj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "_cdec.pyx":28
+ /* "_cdec.pyx":61
*
* def __dealloc__(self):
* del self.dec # <<<<<<<<<<<<<<
@@ -9025,7 +13002,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7weights_1__get__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "_cdec.pyx":31
+/* "_cdec.pyx":64
*
* property weights:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -9038,7 +13015,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_7weights___get__(struct __pyx_obj_5_cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
- /* "_cdec.pyx":32
+ /* "_cdec.pyx":65
* property weights:
* def __get__(self):
* return self.weights # <<<<<<<<<<<<<<
@@ -9068,7 +13045,7 @@ static int __pyx_pw_5_cdec_7Decoder_7weights_3__set__(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "_cdec.pyx":34
+/* "_cdec.pyx":67
* return self.weights
*
* def __set__(self, weights): # <<<<<<<<<<<<<<
@@ -9095,7 +13072,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":35
+ /* "_cdec.pyx":68
*
* def __set__(self, weights):
* if isinstance(weights, DenseVector): # <<<<<<<<<<<<<<
@@ -9108,7 +13085,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":36
+ /* "_cdec.pyx":69
* def __set__(self, weights):
* if isinstance(weights, DenseVector):
* self.weights.vector[0] = (<DenseVector> weights).vector[0] # <<<<<<<<<<<<<<
@@ -9119,7 +13096,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
goto __pyx_L3;
}
- /* "_cdec.pyx":37
+ /* "_cdec.pyx":70
* if isinstance(weights, DenseVector):
* self.weights.vector[0] = (<DenseVector> weights).vector[0]
* elif isinstance(weights, SparseVector): # <<<<<<<<<<<<<<
@@ -9132,7 +13109,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":38
+ /* "_cdec.pyx":71
* self.weights.vector[0] = (<DenseVector> weights).vector[0]
* elif isinstance(weights, SparseVector):
* self.weights.vector.clear() # <<<<<<<<<<<<<<
@@ -9141,7 +13118,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":39
+ /* "_cdec.pyx":72
* elif isinstance(weights, SparseVector):
* self.weights.vector.clear()
* ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector) # <<<<<<<<<<<<<<
@@ -9152,7 +13129,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
goto __pyx_L3;
}
- /* "_cdec.pyx":40
+ /* "_cdec.pyx":73
* self.weights.vector.clear()
* ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector)
* elif isinstance(weights, dict): # <<<<<<<<<<<<<<
@@ -9165,23 +13142,23 @@ 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":41
+ /* "_cdec.pyx":74
* ((<SparseVector> weights).vector[0]).init_vector(self.weights.vector)
* elif isinstance(weights, dict):
* 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 = 41; __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 = 74; __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 = 41; __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 = 74; __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 = 41; __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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
@@ -9198,7 +13175,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
if (unlikely(!__pyx_t_3)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -9210,7 +13187,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
@@ -9218,7 +13195,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_6 = PyList_GET_ITEM(sequence, 0);
__pyx_t_7 = PyList_GET_ITEM(sequence, 1);
@@ -9228,7 +13205,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
__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 = 41; __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 = 74; __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;
@@ -9236,14 +13213,14 @@ 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 = 41; __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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L7_unpacking_done;
__pyx_L6_unpacking_failed:;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_fname);
@@ -9253,40 +13230,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":42
+ /* "_cdec.pyx":75
* elif isinstance(weights, dict):
* 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 = 42; __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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L3;
}
/*else*/ {
- /* "_cdec.pyx":44
+ /* "_cdec.pyx":77
* self.weights[fname] = fval
* else:
* raise TypeError('cannot initialize weights with %s' % type(weights)) # <<<<<<<<<<<<<<
*
- * def read_weights(self, cfg):
+ * property formalism:
*/
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __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 = 44; __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 = 77; __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 = 44; __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 = 77; __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 = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -9308,25 +13285,89 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De
}
/* Python wrapper */
-static PyObject *__pyx_pw_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self, PyObject *__pyx_v_cfg); /*proto*/
-static PyObject *__pyx_pw_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self, PyObject *__pyx_v_cfg) {
+static PyObject *__pyx_pw_5_cdec_7Decoder_9formalism_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5_cdec_7Decoder_9formalism_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_5_cdec_7Decoder_9formalism___get__(((struct __pyx_obj_5_cdec_Decoder *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "_cdec.pyx":80
+ *
+ * property formalism:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef variables_map* conf = &self.dec.GetConf()
+ * 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) {
+ const boost::program_options::variables_map *__pyx_v_conf;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+
+ /* "_cdec.pyx":81
+ * property formalism:
+ * def __get__(self):
+ * cdef variables_map* conf = &self.dec.GetConf() # <<<<<<<<<<<<<<
+ * return conf[0]['formalism'].as_str().c_str()
+ *
+ */
+ __pyx_v_conf = (&__pyx_v_self->dec->GetConf());
+
+ /* "_cdec.pyx":82
+ * def __get__(self):
+ * cdef variables_map* conf = &self.dec.GetConf()
+ * return conf[0]['formalism'].as_str().c_str() # <<<<<<<<<<<<<<
+ *
+ * def read_weights(self, weights):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_r = ((PyObject *)__pyx_t_1);
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("_cdec.Decoder.formalism.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/
+static PyObject *__pyx_pw_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self, PyObject *__pyx_v_weights) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("read_weights (wrapper)", 0);
- __pyx_r = __pyx_pf_5_cdec_7Decoder_4read_weights(((struct __pyx_obj_5_cdec_Decoder *)__pyx_v_self), ((PyObject *)__pyx_v_cfg));
+ __pyx_r = __pyx_pf_5_cdec_7Decoder_4read_weights(((struct __pyx_obj_5_cdec_Decoder *)__pyx_v_self), ((PyObject *)__pyx_v_weights));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "_cdec.pyx":46
- * raise TypeError('cannot initialize weights with %s' % type(weights))
+/* "_cdec.pyx":84
+ * return conf[0]['formalism'].as_str().c_str()
*
- * def read_weights(self, cfg): # <<<<<<<<<<<<<<
- * with open(cfg) as fp:
+ * def read_weights(self, weights): # <<<<<<<<<<<<<<
+ * with open(weights) as fp:
* for line in fp:
*/
-static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_cfg) {
+static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights) {
PyObject *__pyx_v_fp = NULL;
PyObject *__pyx_v_line = NULL;
PyObject *__pyx_v_fname = NULL;
@@ -9342,11 +13383,11 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
PyObject *__pyx_t_7 = NULL;
Py_ssize_t __pyx_t_8;
PyObject *(*__pyx_t_9)(PyObject *);
- PyObject *__pyx_t_10 = NULL;
+ int __pyx_t_10;
PyObject *__pyx_t_11 = NULL;
- PyObject *(*__pyx_t_12)(PyObject *);
- double __pyx_t_13;
- int __pyx_t_14;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *(*__pyx_t_13)(PyObject *);
+ double __pyx_t_14;
PyObject *__pyx_t_15 = NULL;
int __pyx_t_16;
int __pyx_lineno = 0;
@@ -9354,27 +13395,27 @@ 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":47
+ /* "_cdec.pyx":85
*
- * def read_weights(self, cfg):
- * with open(cfg) as fp: # <<<<<<<<<<<<<<
+ * def read_weights(self, weights):
+ * with open(weights) as fp: # <<<<<<<<<<<<<<
* for line in fp:
- * fname, value = line.split()
+ * if line.strip().startswith('#'): continue
*/
/*with:*/ {
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __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 = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_INCREF(__pyx_v_cfg);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_cfg);
- __Pyx_GIVEREF(__pyx_v_cfg);
- __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 = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 85; __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 = 47; __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 = 85; __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 = 47; __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 = 85; __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 = 47; __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 = 85; __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;
@@ -9389,18 +13430,18 @@ 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":48
- * def read_weights(self, cfg):
- * with open(cfg) as fp:
+ /* "_cdec.pyx":86
+ * def read_weights(self, weights):
+ * with open(weights) as fp:
* for line in fp: # <<<<<<<<<<<<<<
+ * if line.strip().startswith('#'): continue
* fname, value = line.split()
- * self.weights[fname.strip()] = float(value)
*/
if (PyList_CheckExact(__pyx_v_fp) || PyTuple_CheckExact(__pyx_v_fp)) {
__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 = 48; __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
}
@@ -9416,7 +13457,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
if (unlikely(!__pyx_t_2)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
break;
}
@@ -9426,85 +13467,112 @@ 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":49
- * with open(cfg) as fp:
+ /* "_cdec.pyx":87
+ * with open(weights) as fp:
* for line in fp:
- * fname, value = line.split() # <<<<<<<<<<<<<<
+ * 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__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __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 = 87; __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 = 87; __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 = 87; __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 = 49; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
- PyObject* sequence = __pyx_t_1;
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_10) {
+ goto __pyx_L16_continue;
+ goto __pyx_L18;
+ }
+ __pyx_L18:;
+
+ /* "_cdec.pyx":88
+ * 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 = 88; __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 = 88; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
+ PyObject* sequence = __pyx_t_2;
if (likely(PyTuple_CheckExact(sequence))) {
if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
- __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
} else {
if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
- __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_11 = PyList_GET_ITEM(sequence, 1);
}
- __Pyx_INCREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __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 = 88; __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;
+ index = 0; __pyx_t_1 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_1)) goto __pyx_L19_unpacking_failed;
+ __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);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
- index = 0; __pyx_t_2 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_2)) goto __pyx_L18_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_2);
- index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L18_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_10);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- goto __pyx_L19_unpacking_done;
- __pyx_L18_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ goto __pyx_L20_unpacking_done;
+ __pyx_L19_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_L19_unpacking_done:;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_L20_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_fname);
- __pyx_v_fname = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_v_fname = __pyx_t_1;
+ __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_v_value);
- __pyx_v_value = __pyx_t_10;
- __pyx_t_10 = 0;
+ __pyx_v_value = __pyx_t_11;
+ __pyx_t_11 = 0;
- /* "_cdec.pyx":50
- * for line in fp:
+ /* "_cdec.pyx":89
+ * if line.strip().startswith('#'): continue
* fname, value = line.split()
* self.weights[fname.strip()] = float(value) # <<<<<<<<<<<<<<
*
* def translate(self, sentence, grammar=None):
*/
- __pyx_t_13 = __Pyx_PyObject_AsDouble(__pyx_v_value); if (unlikely(__pyx_t_13 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_1 = PyFloat_FromDouble(__pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_10 = PyObject_GetAttr(__pyx_v_fname, __pyx_n_s__strip); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __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 = 89; __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 = 89; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_t_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_11 = PyObject_GetAttr(__pyx_v_fname, __pyx_n_s__strip); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __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 = 89; __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 = 89; __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:;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
@@ -9513,58 +13581,58 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "_cdec.pyx":47
+ /* "_cdec.pyx":85
*
- * def read_weights(self, cfg):
- * with open(cfg) as fp: # <<<<<<<<<<<<<<
+ * def read_weights(self, weights):
+ * with open(weights) as fp: # <<<<<<<<<<<<<<
* for line in fp:
- * fname, value = line.split()
+ * if line.strip().startswith('#'): continue
*/
/*except:*/ {
__Pyx_AddTraceback("_cdec.Decoder.read_weights", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __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 = 85; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_11);
__Pyx_INCREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
__Pyx_INCREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_15 = PyObject_Call(__pyx_t_3, __pyx_t_10, NULL);
+ __Pyx_INCREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_1);
+ __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 = 47; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_15);
- __pyx_t_14 = __Pyx_PyObject_IsTrue(__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_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __pyx_t_16 = (!__pyx_t_14);
+ if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_16 = (!__pyx_t_10);
if (__pyx_t_16) {
__Pyx_GIVEREF(__pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_2);
- __Pyx_ErrRestore(__pyx_t_4, __pyx_t_1, __pyx_t_2);
- __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- goto __pyx_L22;
+ __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 = 85; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ goto __pyx_L23;
}
- __pyx_L22:;
- __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+ __pyx_L23:;
+ __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
@@ -9583,20 +13651,20 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
}
/*finally:*/ {
if (__pyx_t_3) {
- __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_38, NULL);
+ __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_46, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __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 = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
}
- goto __pyx_L23;
+ goto __pyx_L24;
__pyx_L3_error:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L1_error;
- __pyx_L23:;
+ __pyx_L24:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -9605,8 +13673,8 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_12);
__Pyx_AddTraceback("_cdec.Decoder.read_weights", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -9631,7 +13699,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO
{
PyObject* values[2] = {0,0};
- /* "_cdec.pyx":52
+ /* "_cdec.pyx":91
* self.weights[fname.strip()] = float(value)
*
* def translate(self, sentence, grammar=None): # <<<<<<<<<<<<<<
@@ -9661,7 +13729,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 = 52; __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 = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -9676,7 +13744,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 = 52; __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 = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_cdec.Decoder.translate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -9702,7 +13770,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":53
+ /* "_cdec.pyx":92
*
* def translate(self, sentence, grammar=None):
* if isinstance(sentence, unicode): # <<<<<<<<<<<<<<
@@ -9715,22 +13783,22 @@ 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_2) {
- /* "_cdec.pyx":54
+ /* "_cdec.pyx":93
* def translate(self, sentence, grammar=None):
* if isinstance(sentence, unicode):
* inp = sentence.strip().encode('utf8') # <<<<<<<<<<<<<<
* elif isinstance(sentence, str):
* inp = sentence.strip()
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __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 = 93; __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 = 54; __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 = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_39), 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_k_tuple_47), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_inp = __pyx_t_3;
@@ -9738,7 +13806,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
goto __pyx_L3;
}
- /* "_cdec.pyx":55
+ /* "_cdec.pyx":94
* if isinstance(sentence, unicode):
* inp = sentence.strip().encode('utf8')
* elif isinstance(sentence, str): # <<<<<<<<<<<<<<
@@ -9751,16 +13819,16 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_2) {
- /* "_cdec.pyx":56
+ /* "_cdec.pyx":95
* inp = sentence.strip().encode('utf8')
* elif isinstance(sentence, str):
* inp = sentence.strip() # <<<<<<<<<<<<<<
* elif isinstance(sentence, Lattice):
* inp = str(sentence) # PLF format
*/
- __pyx_t_3 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_inp = __pyx_t_1;
@@ -9768,7 +13836,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
goto __pyx_L3;
}
- /* "_cdec.pyx":57
+ /* "_cdec.pyx":96
* elif isinstance(sentence, str):
* inp = sentence.strip()
* elif isinstance(sentence, Lattice): # <<<<<<<<<<<<<<
@@ -9781,19 +13849,19 @@ 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_2) {
- /* "_cdec.pyx":58
+ /* "_cdec.pyx":97
* inp = sentence.strip()
* elif isinstance(sentence, Lattice):
* inp = 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 = 58; __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 = 97; __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_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_v_inp = __pyx_t_3;
@@ -9802,53 +13870,53 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
}
/*else*/ {
- /* "_cdec.pyx":60
+ /* "_cdec.pyx":99
* inp = str(sentence) # PLF format
* else:
* raise TypeError('Cannot translate input type %s' % type(sentence)) # <<<<<<<<<<<<<<
* if grammar:
* self.dec.SetSentenceGrammarFromString(string(<char *> grammar))
*/
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_40), ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __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 = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
- /* "_cdec.pyx":61
+ /* "_cdec.pyx":100
* else:
* raise TypeError('Cannot translate input type %s' % type(sentence))
* if grammar: # <<<<<<<<<<<<<<
* self.dec.SetSentenceGrammarFromString(string(<char *> grammar))
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
*/
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_grammar); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_grammar); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "_cdec.pyx":62
+ /* "_cdec.pyx":101
* raise TypeError('Cannot translate input type %s' % type(sentence))
* if grammar:
* self.dec.SetSentenceGrammarFromString(string(<char *> grammar)) # <<<<<<<<<<<<<<
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
* self.dec.Decode(string(<char *>inp), &observer)
*/
- __pyx_t_4 = PyBytes_AsString(__pyx_v_grammar); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyBytes_AsString(__pyx_v_grammar); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->dec->SetSentenceGrammarFromString(std::string(((char *)__pyx_t_4)));
goto __pyx_L4;
}
__pyx_L4:;
- /* "_cdec.pyx":63
+ /* "_cdec.pyx":102
* if grammar:
* self.dec.SetSentenceGrammarFromString(string(<char *> grammar))
* cdef decoder.BasicObserver observer = decoder.BasicObserver() # <<<<<<<<<<<<<<
@@ -9857,17 +13925,17 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
*/
__pyx_v_observer = BasicObserver();
- /* "_cdec.pyx":64
+ /* "_cdec.pyx":103
* self.dec.SetSentenceGrammarFromString(string(<char *> grammar))
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
* self.dec.Decode(string(<char *>inp), &observer) # <<<<<<<<<<<<<<
* if observer.hypergraph == NULL:
* raise ParseFailed()
*/
- __pyx_t_4 = PyBytes_AsString(__pyx_v_inp); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyBytes_AsString(__pyx_v_inp); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->dec->Decode(std::string(((char *)__pyx_t_4)), (&__pyx_v_observer));
- /* "_cdec.pyx":65
+ /* "_cdec.pyx":104
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
* self.dec.Decode(string(<char *>inp), &observer)
* if observer.hypergraph == NULL: # <<<<<<<<<<<<<<
@@ -9877,38 +13945,38 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec
__pyx_t_2 = (__pyx_v_observer.hypergraph == NULL);
if (__pyx_t_2) {
- /* "_cdec.pyx":66
+ /* "_cdec.pyx":105
* self.dec.Decode(string(<char *>inp), &observer)
* if observer.hypergraph == NULL:
* raise ParseFailed() # <<<<<<<<<<<<<<
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseFailed); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseFailed); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
- /* "_cdec.pyx":67
+ /* "_cdec.pyx":106
* if observer.hypergraph == NULL:
* raise ParseFailed()
* cdef Hypergraph hg = Hypergraph() # <<<<<<<<<<<<<<
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
* return hg
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_hg = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "_cdec.pyx":68
+ /* "_cdec.pyx":107
* raise ParseFailed()
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0]) # <<<<<<<<<<<<<<
@@ -9916,7 +13984,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":69
+ /* "_cdec.pyx":108
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
* return hg # <<<<<<<<<<<<<<
@@ -10345,13 +14413,25 @@ static void __pyx_tp_dealloc_5_cdec_Hypergraph(PyObject *o) {
(*Py_TYPE(o)->tp_free)(o);
}
+static PyObject *__pyx_getprop_5_cdec_10Hypergraph_edges(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_10Hypergraph_nodes(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_10Hypergraph_goal(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(o);
+}
+
static PyMethodDef __pyx_methods_5_cdec_Hypergraph[] = {
{__Pyx_NAMESTR("viterbi"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_3viterbi, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("viterbi_tree"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_5viterbi_tree, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("viterbi_source_tree"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_7viterbi_source_tree, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("viterbi_features"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_9viterbi_features, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("viterbi_trees"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_5viterbi_trees, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("viterbi_features"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_7viterbi_features, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("viterbi_joshua"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_9viterbi_joshua, METH_NOARGS, __Pyx_DOCSTR(0)},
{__Pyx_NAMESTR("kbest"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_11kbest, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("kbest_tree"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_14kbest_tree, METH_O, __Pyx_DOCSTR(0)},
+ {__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)},
@@ -10361,6 +14441,13 @@ static PyMethodDef __pyx_methods_5_cdec_Hypergraph[] = {
{0, 0, 0, 0}
};
+static struct PyGetSetDef __pyx_getsets_5_cdec_Hypergraph[] = {
+ {(char *)"edges", __pyx_getprop_5_cdec_10Hypergraph_edges, 0, 0, 0},
+ {(char *)"nodes", __pyx_getprop_5_cdec_10Hypergraph_nodes, 0, 0, 0},
+ {(char *)"goal", __pyx_getprop_5_cdec_10Hypergraph_goal, 0, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
static PyNumberMethods __pyx_tp_as_number_Hypergraph = {
0, /*nb_add*/
0, /*nb_subtract*/
@@ -10493,7 +14580,7 @@ static PyTypeObject __pyx_type_5_cdec_Hypergraph = {
0, /*tp_iternext*/
__pyx_methods_5_cdec_Hypergraph, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_5_cdec_Hypergraph, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -10515,6 +14602,635 @@ static PyTypeObject __pyx_type_5_cdec_Hypergraph = {
#endif
};
+static PyObject *__pyx_tp_new_5_cdec_TRule(PyTypeObject *t, PyObject *a, PyObject *k) {
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_5_cdec_TRule(PyObject *o) {
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_5TRule_arity(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_5TRule_5arity_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_5TRule_f(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_5TRule_1f_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_5TRule_e(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_5TRule_1e_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_5TRule_scores(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_5TRule_6scores_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_5TRule_lhs(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_5TRule_3lhs_1__get__(o);
+}
+
+static PyMethodDef __pyx_methods_5_cdec_TRule[] = {
+ {0, 0, 0, 0}
+};
+
+static struct PyGetSetDef __pyx_getsets_5_cdec_TRule[] = {
+ {(char *)"arity", __pyx_getprop_5_cdec_5TRule_arity, 0, 0, 0},
+ {(char *)"f", __pyx_getprop_5_cdec_5TRule_f, 0, 0, 0},
+ {(char *)"e", __pyx_getprop_5_cdec_5TRule_e, 0, 0, 0},
+ {(char *)"scores", __pyx_getprop_5_cdec_5TRule_scores, 0, 0, 0},
+ {(char *)"lhs", __pyx_getprop_5_cdec_5TRule_lhs, 0, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_TRule = {
+ 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_TRule = {
+ 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_TRule = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer_TRule = {
+ #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_TRule = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.TRule"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_TRule), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec_TRule, /*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_TRule, /*tp_as_number*/
+ &__pyx_tp_as_sequence_TRule, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_TRule, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ __pyx_pw_5_cdec_5TRule_1__str__, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ &__pyx_tp_as_buffer_TRule, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec_TRule, /*tp_methods*/
+ 0, /*tp_members*/
+ __pyx_getsets_5_cdec_TRule, /*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_TRule, /*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 struct __pyx_vtabstruct_5_cdec_HypergraphEdge __pyx_vtable_5_cdec_HypergraphEdge;
+
+static PyObject *__pyx_tp_new_5_cdec_HypergraphEdge(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec_HypergraphEdge *p;
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec_HypergraphEdge *)o);
+ p->__pyx_vtab = __pyx_vtabptr_5_cdec_HypergraphEdge;
+ p->trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ return o;
+}
+
+static void __pyx_tp_dealloc_5_cdec_HypergraphEdge(PyObject *o) {
+ struct __pyx_obj_5_cdec_HypergraphEdge *p = (struct __pyx_obj_5_cdec_HypergraphEdge *)o;
+ Py_XDECREF(((PyObject *)p->trule));
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_5_cdec_HypergraphEdge(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec_HypergraphEdge *p = (struct __pyx_obj_5_cdec_HypergraphEdge *)o;
+ if (p->trule) {
+ e = (*v)(((PyObject*)p->trule), a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_5_cdec_HypergraphEdge(PyObject *o) {
+ struct __pyx_obj_5_cdec_HypergraphEdge *p = (struct __pyx_obj_5_cdec_HypergraphEdge *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->trule);
+ p->trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_head_node(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_tail_nodes(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_span(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_feature_values(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_prob(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_trule(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(o);
+}
+
+static int __pyx_setprop_5_cdec_14HypergraphEdge_trule(PyObject *o, PyObject *v, void *x) {
+ if (v) {
+ return __pyx_pw_5_cdec_14HypergraphEdge_5trule_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_5_cdec_14HypergraphEdge_5trule_5__del__(o);
+ }
+}
+
+static PyMethodDef __pyx_methods_5_cdec_HypergraphEdge[] = {
+ {0, 0, 0, 0}
+};
+
+static struct PyGetSetDef __pyx_getsets_5_cdec_HypergraphEdge[] = {
+ {(char *)"head_node", __pyx_getprop_5_cdec_14HypergraphEdge_head_node, 0, 0, 0},
+ {(char *)"tail_nodes", __pyx_getprop_5_cdec_14HypergraphEdge_tail_nodes, 0, 0, 0},
+ {(char *)"span", __pyx_getprop_5_cdec_14HypergraphEdge_span, 0, 0, 0},
+ {(char *)"feature_values", __pyx_getprop_5_cdec_14HypergraphEdge_feature_values, 0, 0, 0},
+ {(char *)"prob", __pyx_getprop_5_cdec_14HypergraphEdge_prob, 0, 0, 0},
+ {(char *)"trule", __pyx_getprop_5_cdec_14HypergraphEdge_trule, __pyx_setprop_5_cdec_14HypergraphEdge_trule, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_HypergraphEdge = {
+ 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_HypergraphEdge = {
+ __pyx_pw_5_cdec_14HypergraphEdge_1__len__, /*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_HypergraphEdge = {
+ __pyx_pw_5_cdec_14HypergraphEdge_1__len__, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer_HypergraphEdge = {
+ #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_HypergraphEdge = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.HypergraphEdge"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_HypergraphEdge), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec_HypergraphEdge, /*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_HypergraphEdge, /*tp_as_number*/
+ &__pyx_tp_as_sequence_HypergraphEdge, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_HypergraphEdge, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ &__pyx_tp_as_buffer_HypergraphEdge, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_doc*/
+ __pyx_tp_traverse_5_cdec_HypergraphEdge, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec_HypergraphEdge, /*tp_clear*/
+ __pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec_HypergraphEdge, /*tp_methods*/
+ 0, /*tp_members*/
+ __pyx_getsets_5_cdec_HypergraphEdge, /*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_HypergraphEdge, /*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 struct __pyx_vtabstruct_5_cdec_HypergraphNode __pyx_vtable_5_cdec_HypergraphNode;
+
+static PyObject *__pyx_tp_new_5_cdec_HypergraphNode(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec_HypergraphNode *p;
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec_HypergraphNode *)o);
+ p->__pyx_vtab = __pyx_vtabptr_5_cdec_HypergraphNode;
+ return o;
+}
+
+static void __pyx_tp_dealloc_5_cdec_HypergraphNode(PyObject *o) {
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_in_edges(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_out_edges(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_span(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_cat(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(o);
+}
+
+static PyMethodDef __pyx_methods_5_cdec_HypergraphNode[] = {
+ {0, 0, 0, 0}
+};
+
+static struct PyGetSetDef __pyx_getsets_5_cdec_HypergraphNode[] = {
+ {(char *)"in_edges", __pyx_getprop_5_cdec_14HypergraphNode_in_edges, 0, 0, 0},
+ {(char *)"out_edges", __pyx_getprop_5_cdec_14HypergraphNode_out_edges, 0, 0, 0},
+ {(char *)"span", __pyx_getprop_5_cdec_14HypergraphNode_span, 0, 0, 0},
+ {(char *)"cat", __pyx_getprop_5_cdec_14HypergraphNode_cat, 0, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_HypergraphNode = {
+ 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_HypergraphNode = {
+ 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_HypergraphNode = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer_HypergraphNode = {
+ #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_HypergraphNode = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.HypergraphNode"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec_HypergraphNode), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec_HypergraphNode, /*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_HypergraphNode, /*tp_as_number*/
+ &__pyx_tp_as_sequence_HypergraphNode, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_HypergraphNode, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ &__pyx_tp_as_buffer_HypergraphNode, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ __pyx_pw_5_cdec_14HypergraphNode_1__richcmp__, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec_HypergraphNode, /*tp_methods*/
+ 0, /*tp_members*/
+ __pyx_getsets_5_cdec_HypergraphNode, /*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_HypergraphNode, /*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_Lattice(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
@@ -11705,6 +16421,10 @@ static int __pyx_setprop_5_cdec_7Decoder_weights(PyObject *o, PyObject *v, void
}
}
+static PyObject *__pyx_getprop_5_cdec_7Decoder_formalism(PyObject *o, void *x) {
+ return __pyx_pw_5_cdec_7Decoder_9formalism_1__get__(o);
+}
+
static PyMethodDef __pyx_methods_5_cdec_Decoder[] = {
{__Pyx_NAMESTR("read_weights"), (PyCFunction)__pyx_pw_5_cdec_7Decoder_5read_weights, METH_O, __Pyx_DOCSTR(0)},
{__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_5_cdec_7Decoder_7translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
@@ -11713,6 +16433,7 @@ static PyMethodDef __pyx_methods_5_cdec_Decoder[] = {
static struct PyGetSetDef __pyx_getsets_5_cdec_Decoder[] = {
{(char *)"weights", __pyx_getprop_5_cdec_7Decoder_weights, __pyx_setprop_5_cdec_7Decoder_weights, 0, 0},
+ {(char *)"formalism", __pyx_getprop_5_cdec_7Decoder_formalism, 0, 0, 0},
{0, 0, 0, 0, 0}
};
@@ -12258,7 +16979,6 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_2_kbest(PyTypeObject *t,
if (!o) return 0;
p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_2_kbest *)o);
p->__pyx_v_self = 0;
- p->__pyx_v_sentence = 0;
p->__pyx_v_size = 0;
return o;
}
@@ -12266,7 +16986,6 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_2_kbest(PyTypeObject *t,
static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_2_kbest(PyObject *o) {
struct __pyx_obj_5_cdec___pyx_scope_struct_2_kbest *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_2_kbest *)o;
Py_XDECREF(((PyObject *)p->__pyx_v_self));
- Py_XDECREF(((PyObject *)p->__pyx_v_sentence));
Py_XDECREF(p->__pyx_v_size);
(*Py_TYPE(o)->tp_free)(o);
}
@@ -12277,9 +16996,6 @@ static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_2_kbest(PyObject *o, visi
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
- if (p->__pyx_v_sentence) {
- e = (*v)(p->__pyx_v_sentence, a); if (e) return e;
- }
if (p->__pyx_v_size) {
e = (*v)(p->__pyx_v_size, a); if (e) return e;
}
@@ -12292,9 +17008,6 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_2_kbest(PyObject *o) {
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_sentence);
- p->__pyx_v_sentence = ((PyObject*)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_size);
p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
@@ -12459,60 +17172,68 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_2_kbest = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_3_kbest_tree(PyTypeObject *t, PyObject *a, PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree *p;
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_3_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees *)o);
+ p->__pyx_v_e_tree = 0;
+ p->__pyx_v_f_tree = 0;
p->__pyx_v_self = 0;
p->__pyx_v_size = 0;
- p->__pyx_v_tree = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_3_kbest_tree(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_3_kbest_trees(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees *)o;
+ Py_XDECREF(((PyObject *)p->__pyx_v_e_tree));
+ Py_XDECREF(((PyObject *)p->__pyx_v_f_tree));
Py_XDECREF(((PyObject *)p->__pyx_v_self));
Py_XDECREF(p->__pyx_v_size);
- Py_XDECREF(((PyObject *)p->__pyx_v_tree));
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_3_kbest_tree(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_3_kbest_trees(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees *)o;
+ if (p->__pyx_v_e_tree) {
+ e = (*v)(p->__pyx_v_e_tree, a); if (e) return e;
+ }
+ if (p->__pyx_v_f_tree) {
+ e = (*v)(p->__pyx_v_f_tree, a); if (e) return e;
+ }
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
if (p->__pyx_v_size) {
e = (*v)(p->__pyx_v_size, a); if (e) return e;
}
- if (p->__pyx_v_tree) {
- e = (*v)(p->__pyx_v_tree, a); if (e) return e;
- }
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_3_kbest_tree(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_3_kbest_trees(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees *)o;
PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_e_tree);
+ p->__pyx_v_e_tree = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_f_tree);
+ p->__pyx_v_f_tree = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_size);
p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_tree);
- p->__pyx_v_tree = ((PyObject*)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_3_kbest_tree[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_3_kbest_trees[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_3_kbest_tree = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_3_kbest_trees = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -12570,7 +17291,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_3_kbest_tree = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_3_kbest_tree = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_3_kbest_trees = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -12583,13 +17304,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_3_kbest_tree =
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_3_kbest_tree = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_3_kbest_trees = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_3_kbest_tree = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_3_kbest_trees = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -12610,12 +17331,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_3_kbest_tree = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_kbest_tree = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_kbest_trees = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_3_kbest_tree"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_tree), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_3_kbest_trees"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_3_kbest_trees), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_3_kbest_tree, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_3_kbest_trees, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -12625,24 +17346,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_kbest_tree = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_3_kbest_tree, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_3_kbest_tree, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_3_kbest_tree, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_3_kbest_trees, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_3_kbest_trees, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_3_kbest_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_3_kbest_tree, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_3_kbest_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_3_kbest_tree, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_3_kbest_tree, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_3_kbest_trees, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_3_kbest_trees, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_3_kbest_tree, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_3_kbest_trees, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -12652,7 +17373,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_kbest_tree = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_3_kbest_tree, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_3_kbest_trees, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -12879,14 +17600,12 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_5_sample(PyTypeObject *t
if (!o) return 0;
p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_5_sample *)o);
p->__pyx_v_self = 0;
- p->__pyx_v_sentence = 0;
return o;
}
static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_5_sample(PyObject *o) {
struct __pyx_obj_5_cdec___pyx_scope_struct_5_sample *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_5_sample *)o;
Py_XDECREF(((PyObject *)p->__pyx_v_self));
- Py_XDECREF(((PyObject *)p->__pyx_v_sentence));
(*Py_TYPE(o)->tp_free)(o);
}
@@ -12896,9 +17615,6 @@ static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_5_sample(PyObject *o, vis
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
- if (p->__pyx_v_sentence) {
- e = (*v)(p->__pyx_v_sentence, a); if (e) return e;
- }
return 0;
}
@@ -12908,9 +17624,6 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_5_sample(PyObject *o) {
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_sentence);
- p->__pyx_v_sentence = ((PyObject*)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
return 0;
}
@@ -13072,32 +17785,1783 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_5_sample = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_6___iter__(PyTypeObject *t, PyObject *a, PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__ *p;
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_6___get__(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_6___get__ *p;
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_6___get__ *)o);
+ p->__pyx_v_self = 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_6___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_6___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6___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_6___get__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_6___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6___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_6___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_6___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6___get__ *)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);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_6___get__[] = {
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_6___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_6___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_6___get__ = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_6___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_6___get__ = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_6___get__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_6___get__), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_6___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_6___get__, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_6___get__, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_6___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_6___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_6___get__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_6___get__, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec___pyx_scope_struct_6___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_6___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_7___get__(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_7___get__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__ *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_7___get__ *)o);
p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_6___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__ *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_7___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_7___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___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_6___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_7___get__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__ *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_7___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___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_6___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__ *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_7___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_7___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___get__ *)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);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_7___get__[] = {
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_7___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_7___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_7___get__ = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_7___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_7___get__ = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_7___get__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_7___get__), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_7___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_7___get__, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_7___get__, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_7___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_7___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_7___get__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_7___get__, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec___pyx_scope_struct_7___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_7___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_8__phrase(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase *p;
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase *)o);
+ p->__pyx_v_phrase = 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_8__phrase(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase *)o;
+ Py_XDECREF(p->__pyx_v_phrase);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_8__phrase(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase *)o;
+ if (p->__pyx_v_phrase) {
+ e = (*v)(p->__pyx_v_phrase, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_8__phrase(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_phrase);
+ p->__pyx_v_phrase = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_8__phrase[] = {
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_8__phrase = {
+ 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_8__phrase = {
+ 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_8__phrase = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_8__phrase = {
+ #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_8__phrase = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_8__phrase"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_8__phrase, /*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_8__phrase, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_8__phrase, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_8__phrase, /*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_8__phrase, /*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_8__phrase, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_8__phrase, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec___pyx_scope_struct_8__phrase, /*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_8__phrase, /*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_9_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_9_genexpr *p;
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_9_genexpr *)o);
+ p->__pyx_outer_scope = 0;
+ p->__pyx_v_w = 0;
+ p->__pyx_t_0 = 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_9_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_9_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_genexpr *)o;
+ Py_XDECREF(((PyObject *)p->__pyx_outer_scope));
+ Py_XDECREF(p->__pyx_v_w);
+ Py_XDECREF(p->__pyx_t_0);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_9_genexpr(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_9_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_genexpr *)o;
+ if (p->__pyx_outer_scope) {
+ e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
+ }
+ if (p->__pyx_v_w) {
+ e = (*v)(p->__pyx_v_w, a); if (e) return e;
+ }
+ if (p->__pyx_t_0) {
+ e = (*v)(p->__pyx_t_0, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_9_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_9_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_genexpr *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_8__phrase *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_w);
+ p->__pyx_v_w = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_0);
+ p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_9_genexpr[] = {
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_9_genexpr = {
+ 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_9_genexpr = {
+ 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_9_genexpr = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_9_genexpr = {
+ #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_9_genexpr = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_9_genexpr"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_9_genexpr), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_9_genexpr, /*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_9_genexpr, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_9_genexpr, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_9_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_9_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_9_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_9_genexpr, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec___pyx_scope_struct_9_genexpr, /*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_9_genexpr, /*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_10___str__(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__ *p;
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__ *)o);
+ p->__pyx_v_self = 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_10___str__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__ *)o;
+ Py_XDECREF(((PyObject *)p->__pyx_v_self));
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_10___str__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__ *)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_10___str__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__ *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_10___str__[] = {
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_10___str__ = {
+ 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_10___str__ = {
+ 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_10___str__ = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_10___str__ = {
+ #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_10___str__ = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_10___str__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_10___str__, /*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_10___str__, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_10___str__, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_10___str__, /*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_10___str__, /*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_10___str__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_10___str__, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec___pyx_scope_struct_10___str__, /*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_10___str__, /*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_11_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_11_genexpr *p;
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_11_genexpr *)o);
+ p->__pyx_outer_scope = 0;
+ p->__pyx_v_feat = 0;
+ p->__pyx_t_0 = 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_11_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_genexpr *)o;
+ Py_XDECREF(((PyObject *)p->__pyx_outer_scope));
+ Py_XDECREF(p->__pyx_v_feat);
+ Py_XDECREF(p->__pyx_t_0);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_11_genexpr(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_genexpr *)o;
+ if (p->__pyx_outer_scope) {
+ e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
+ }
+ if (p->__pyx_v_feat) {
+ e = (*v)(p->__pyx_v_feat, a); if (e) return e;
+ }
+ if (p->__pyx_t_0) {
+ e = (*v)(p->__pyx_t_0, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_11_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_11_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_genexpr *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_10___str__ *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_feat);
+ p->__pyx_v_feat = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_0);
+ p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_11_genexpr[] = {
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_11_genexpr = {
+ 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_11_genexpr = {
+ 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_11_genexpr = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_11_genexpr = {
+ #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_11_genexpr = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_11_genexpr"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_11_genexpr), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_11_genexpr, /*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_11_genexpr, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_11_genexpr, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_11_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_11_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_11_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_11_genexpr, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec___pyx_scope_struct_11_genexpr, /*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_11_genexpr, /*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_12___get__(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *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->__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;
+ 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) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_12___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12___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_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;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphEdge *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_12___get__[] = {
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_12___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_12___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_12___get__ = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_12___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_12___get__ = {
+ 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*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_12___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_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*/
+ 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*/
+ 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*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec___pyx_scope_struct_12___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_12___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_13___get__(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p;
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o);
+ p->__pyx_v_self = 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_13___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___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_13___get__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___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_13___get__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___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_13___get__[] = {
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_13___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_13___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_13___get__ = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_13___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_13___get__ = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_13___get__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_13___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_13___get__, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_13___get__, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_13___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_13___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_13___get__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_13___get__, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec___pyx_scope_struct_13___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_13___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_14___get__(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p;
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o);
+ p->__pyx_v_self = 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_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;
+ Py_XDECREF(((PyObject *)p->__pyx_v_self));
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_14___get__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___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_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_HypergraphNode *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_14___get__[] = {
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_14___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_14___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_14___get__ = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_14___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_14___get__ = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_14___get__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_14___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_14___get__, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_14___get__, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_14___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_14___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_14___get__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_14___get__, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec___pyx_scope_struct_14___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_14___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_15___iter__(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_15___iter__ *p;
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_15___iter__ *)o);
+ p->__pyx_v_self = 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_15___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_15___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___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_15___iter__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_15___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___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_15___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_15___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___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);
@@ -13105,11 +19569,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_6___iter__(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_6___iter__[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_15___iter__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_6___iter__ = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_15___iter__ = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -13167,7 +19631,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_6___iter__ = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_6___iter__ = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_15___iter__ = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -13180,13 +19644,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_6___iter__ = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_6___iter__ = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_15___iter__ = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_6___iter__ = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_15___iter__ = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -13207,12 +19671,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_6___iter__ = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_6___iter__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_15___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_6___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_6___iter__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_15___iter__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_15___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_6___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_15___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -13222,24 +19686,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_6___iter__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_6___iter__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_6___iter__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_6___iter__, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_15___iter__, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_15___iter__, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_15___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_6___iter__, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_15___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_6___iter__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_6___iter__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_15___iter__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_15___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_6___iter__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_15___iter__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -13249,7 +19713,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_6___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_6___iter__, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_15___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -13263,32 +19727,32 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_6___iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_7_todot(PyTypeObject *t, PyObject *a, PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_7_todot *p;
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_16_todot(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_16_todot *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_7_todot *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_16_todot *)o);
p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_7_todot(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_7_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7_todot *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_16_todot(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_16_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_16_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_7_todot(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_16_todot(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_7_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7_todot *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_16_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_16_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_7_todot(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_7_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7_todot *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_16_todot(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_16_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_16_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);
@@ -13296,11 +19760,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_7_todot(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_7_todot[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_16_todot[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_7_todot = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_16_todot = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -13358,7 +19822,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_7_todot = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_7_todot = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_16_todot = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -13371,13 +19835,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_7_todot = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_7_todot = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_16_todot = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_7_todot = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_16_todot = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -13398,12 +19862,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_7_todot = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7_todot = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_16_todot = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_7_todot"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_7_todot), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_16_todot"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_16_todot), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_7_todot, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_16_todot, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -13413,24 +19877,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7_todot = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_7_todot, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_7_todot, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_7_todot, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_16_todot, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_16_todot, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_16_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_7_todot, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_16_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_7_todot, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_7_todot, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_16_todot, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_16_todot, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_7_todot, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_16_todot, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -13440,7 +19904,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7_todot = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_7_todot, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_16_todot, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -13454,11 +19918,11 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7_todot = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_8_lines(PyTypeObject *t, PyObject *a, PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines *p;
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_17_lines(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines *)o);
p->__pyx_outer_scope = 0;
p->__pyx_v_delta = 0;
p->__pyx_v_i = 0;
@@ -13469,8 +19933,8 @@ static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_8_lines(PyTypeObject *t,
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_8_lines(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_17_lines(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines *)o;
Py_XDECREF(((PyObject *)p->__pyx_outer_scope));
Py_XDECREF(p->__pyx_v_delta);
Py_XDECREF(p->__pyx_v_i);
@@ -13481,9 +19945,9 @@ static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_8_lines(PyObject *o) {
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_8_lines(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_17_lines(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines *)o;
if (p->__pyx_outer_scope) {
e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
}
@@ -13508,11 +19972,11 @@ static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_8_lines(PyObject *o, visi
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_8_lines(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_17_lines(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines *)o;
PyObject* tmp;
tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_7_todot *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_16_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);
@@ -13535,11 +19999,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_8_lines(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_8_lines[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_17_lines[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_8_lines = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_17_lines = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -13597,7 +20061,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_8_lines = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_8_lines = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_17_lines = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -13610,13 +20074,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_8_lines = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_8_lines = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_17_lines = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_8_lines = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_17_lines = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -13637,12 +20101,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_8_lines = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_8_lines = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17_lines = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_8_lines"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_8_lines), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_17_lines"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_17_lines), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_8_lines, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_17_lines, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -13652,24 +20116,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_8_lines = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_8_lines, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_8_lines, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_8_lines, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_17_lines, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_17_lines, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_17_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_8_lines, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_17_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_8_lines, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_8_lines, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_17_lines, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_17_lines, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_8_lines, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_17_lines, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -13679,7 +20143,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_8_lines = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_8_lines, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_17_lines, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -13693,28 +20157,28 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_8_lines = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_9___iter__(PyTypeObject *t, PyObject *a, PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_9___iter__ *p;
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__(PyTypeObject *t, PyObject *a, 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_9___iter__ *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_18___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_9___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_9___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9___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(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_9___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_9___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9___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_i) {
e = (*v)(p->__pyx_v_i, a); if (e) return e;
}
@@ -13727,8 +20191,8 @@ static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_9___iter__(PyObject *o, v
return 0;
}
-static int __pyx_tp_clear_5_cdec___pyx_scope_struct_9___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_9___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9___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_i);
p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
@@ -13742,11 +20206,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_9___iter__(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_9___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_9___iter__ = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_18___iter__ = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -13804,7 +20268,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_9___iter__ = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_9___iter__ = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_18___iter__ = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -13817,13 +20281,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_9___iter__ = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_9___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_9___iter__ = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_18___iter__ = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -13844,12 +20308,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_9___iter__ = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9___iter__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_9___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_9___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_9___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_18___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -13859,24 +20323,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9___iter__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_9___iter__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_9___iter__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_9___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_9___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_9___iter__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_9___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_9___iter__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_18___iter__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -13886,7 +20350,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_9___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*/
@@ -13900,32 +20364,32 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9___iter__ = {
#endif
};
-static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_10___iter__(PyTypeObject *t, PyObject *a, PyObject *k) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__ *p;
+static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_19___iter__(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19___iter__ *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
- p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__ *)o);
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19___iter__ *)o);
p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_10___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__ *)o;
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19___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_10___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_19___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__ *)o;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19___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_10___iter__(PyObject *o) {
- struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__ *)o;
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_19___iter__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_19___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19___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);
@@ -13933,11 +20397,11 @@ static int __pyx_tp_clear_5_cdec___pyx_scope_struct_10___iter__(PyObject *o) {
return 0;
}
-static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_10___iter__[] = {
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_19___iter__[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_10___iter__ = {
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_19___iter__ = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
@@ -13995,7 +20459,7 @@ static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_10___iter__ = {
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_10___iter__ = {
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_19___iter__ = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
@@ -14008,13 +20472,13 @@ static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_10___iter__ = {
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_10___iter__ = {
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_19___iter__ = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
-static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_10___iter__ = {
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_19___iter__ = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
@@ -14035,12 +20499,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_10___iter__ = {
#endif
};
-static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_10___iter__ = {
+static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("_cdec.__pyx_scope_struct_10___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_10___iter__), /*tp_basicsize*/
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_19___iter__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_19___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_5_cdec___pyx_scope_struct_10___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -14050,24 +20514,24 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_10___iter__ = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number___pyx_scope_struct_10___iter__, /*tp_as_number*/
- &__pyx_tp_as_sequence___pyx_scope_struct_10___iter__, /*tp_as_sequence*/
- &__pyx_tp_as_mapping___pyx_scope_struct_10___iter__, /*tp_as_mapping*/
+ &__pyx_tp_as_number___pyx_scope_struct_19___iter__, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_19___iter__, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_19___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_10___iter__, /*tp_as_buffer*/
+ &__pyx_tp_as_buffer___pyx_scope_struct_19___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_10___iter__, /*tp_traverse*/
- __pyx_tp_clear_5_cdec___pyx_scope_struct_10___iter__, /*tp_clear*/
+ __pyx_tp_traverse_5_cdec___pyx_scope_struct_19___iter__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_19___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_5_cdec___pyx_scope_struct_10___iter__, /*tp_methods*/
+ __pyx_methods_5_cdec___pyx_scope_struct_19___iter__, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -14077,7 +20541,644 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_10___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_5_cdec___pyx_scope_struct_10___iter__, /*tp_new*/
+ __pyx_tp_new_5_cdec___pyx_scope_struct_19___iter__, /*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_20__make_config(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20__make_config *p;
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_20__make_config *)o);
+ p->__pyx_v_config = 0;
+ p->__pyx_v_info = 0;
+ p->__pyx_v_key = 0;
+ p->__pyx_v_name = 0;
+ p->__pyx_v_value = 0;
+ p->__pyx_t_0 = 0;
+ p->__pyx_t_1 = 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20__make_config(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20__make_config *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20__make_config *)o;
+ Py_XDECREF(p->__pyx_v_config);
+ Py_XDECREF(p->__pyx_v_info);
+ Py_XDECREF(p->__pyx_v_key);
+ Py_XDECREF(p->__pyx_v_name);
+ Py_XDECREF(p->__pyx_v_value);
+ Py_XDECREF(p->__pyx_t_0);
+ Py_XDECREF(p->__pyx_t_1);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_20__make_config(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20__make_config *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20__make_config *)o;
+ if (p->__pyx_v_config) {
+ e = (*v)(p->__pyx_v_config, a); if (e) return e;
+ }
+ if (p->__pyx_v_info) {
+ e = (*v)(p->__pyx_v_info, a); if (e) return e;
+ }
+ if (p->__pyx_v_key) {
+ e = (*v)(p->__pyx_v_key, a); if (e) return e;
+ }
+ if (p->__pyx_v_name) {
+ e = (*v)(p->__pyx_v_name, a); if (e) return e;
+ }
+ if (p->__pyx_v_value) {
+ e = (*v)(p->__pyx_v_value, a); if (e) return e;
+ }
+ if (p->__pyx_t_0) {
+ e = (*v)(p->__pyx_t_0, a); if (e) return e;
+ }
+ if (p->__pyx_t_1) {
+ e = (*v)(p->__pyx_t_1, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_20__make_config(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_20__make_config *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20__make_config *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_config);
+ p->__pyx_v_config = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_info);
+ p->__pyx_v_info = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_key);
+ p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_name);
+ p->__pyx_v_name = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_value);
+ p->__pyx_v_value = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_0);
+ p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_1);
+ p->__pyx_t_1 = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_20__make_config[] = {
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_20__make_config = {
+ 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_20__make_config = {
+ 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_20__make_config = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_20__make_config = {
+ #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_20__make_config = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_20__make_config"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_20__make_config), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20__make_config, /*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_20__make_config, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_20__make_config, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_20__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_20__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_20__make_config, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_20__make_config, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec___pyx_scope_struct_20__make_config, /*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_20__make_config, /*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_21___cinit__(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___cinit__ *p;
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_21___cinit__ *)o);
+ p->__pyx_v_config = 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_21___cinit__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___cinit__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___cinit__ *)o;
+ Py_XDECREF(p->__pyx_v_config);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_21___cinit__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___cinit__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___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_21___cinit__(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_21___cinit__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___cinit__ *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_v_config);
+ p->__pyx_v_config = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_21___cinit__[] = {
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_21___cinit__ = {
+ 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_21___cinit__ = {
+ 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_21___cinit__ = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_21___cinit__ = {
+ #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_21___cinit__ = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_21___cinit__"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_21___cinit__), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_21___cinit__, /*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_21___cinit__, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_21___cinit__, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_21___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_21___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_21___cinit__, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_21___cinit__, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec___pyx_scope_struct_21___cinit__, /*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_21___cinit__, /*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_22_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22_genexpr *p;
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_22_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_22_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22_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_22_genexpr(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22_genexpr *)o;
+ if (p->__pyx_outer_scope) {
+ e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
+ }
+ if (p->__pyx_v_kv) {
+ e = (*v)(p->__pyx_v_kv, a); if (e) return e;
+ }
+ if (p->__pyx_t_0) {
+ e = (*v)(p->__pyx_t_0, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_5_cdec___pyx_scope_struct_22_genexpr(PyObject *o) {
+ struct __pyx_obj_5_cdec___pyx_scope_struct_22_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22_genexpr *)o;
+ PyObject* tmp;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_21___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);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_0);
+ p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_22_genexpr[] = {
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_22_genexpr = {
+ 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_22_genexpr = {
+ 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_22_genexpr = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_22_genexpr = {
+ #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_22_genexpr = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("_cdec.__pyx_scope_struct_22_genexpr"), /*tp_name*/
+ sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_22_genexpr), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_5_cdec___pyx_scope_struct_22_genexpr, /*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_22_genexpr, /*tp_as_number*/
+ &__pyx_tp_as_sequence___pyx_scope_struct_22_genexpr, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping___pyx_scope_struct_22_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_22_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_22_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_5_cdec___pyx_scope_struct_22_genexpr, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_5_cdec___pyx_scope_struct_22_genexpr, /*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_22_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -14111,29 +21212,42 @@ static struct PyModuleDef __pyx_moduledef = {
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
- {&__pyx_n_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 1},
+ {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
{&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
+ {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
{&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
- {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
+ {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
+ {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
{&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
- {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
- {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
- {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
- {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
{&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
{&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
+ {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
{&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
{&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
+ {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
+ {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
{&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
{&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
- {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
+ {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
{&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
{&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
+ {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
+ {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
{&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
+ {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
+ {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
+ {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
+ {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
+ {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
+ {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
+ {&__pyx_n_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 1},
+ {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
+ {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
{&__pyx_n_s__BLEU, __pyx_k__BLEU, sizeof(__pyx_k__BLEU), 0, 0, 1, 1},
{&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
{&__pyx_n_s__IBM_BLEU, __pyx_k__IBM_BLEU, sizeof(__pyx_k__IBM_BLEU), 0, 0, 1, 1},
{&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
+ {&__pyx_n_s__InvalidConfig, __pyx_k__InvalidConfig, sizeof(__pyx_k__InvalidConfig), 0, 0, 1, 1},
{&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
{&__pyx_n_s__NotImplemented, __pyx_k__NotImplemented, sizeof(__pyx_k__NotImplemented), 0, 0, 1, 1},
{&__pyx_n_s__ParseFailed, __pyx_k__ParseFailed, sizeof(__pyx_k__ParseFailed), 0, 0, 1, 1},
@@ -14144,50 +21258,73 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
{&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
{&__pyx_n_s___cdec, __pyx_k___cdec, sizeof(__pyx_k___cdec), 0, 0, 1, 1},
+ {&__pyx_n_s___make_config, __pyx_k___make_config, sizeof(__pyx_k___make_config), 0, 0, 1, 1},
+ {&__pyx_n_s___phrase, __pyx_k___phrase, sizeof(__pyx_k___phrase), 0, 0, 1, 1},
{&__pyx_n_s__beam_alpha, __pyx_k__beam_alpha, sizeof(__pyx_k__beam_alpha), 0, 0, 1, 1},
{&__pyx_n_s__config, __pyx_k__config, sizeof(__pyx_k__config), 0, 0, 1, 1},
- {&__pyx_n_s__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1},
+ {&__pyx_n_s__config_str, __pyx_k__config_str, sizeof(__pyx_k__config_str), 0, 0, 1, 1},
+ {&__pyx_n_s__csplit, __pyx_k__csplit, sizeof(__pyx_k__csplit), 0, 0, 1, 1},
{&__pyx_n_s__delta, __pyx_k__delta, sizeof(__pyx_k__delta), 0, 0, 1, 1},
{&__pyx_n_s__density, __pyx_k__density, sizeof(__pyx_k__density), 0, 0, 1, 1},
{&__pyx_n_s__dot, __pyx_k__dot, sizeof(__pyx_k__dot), 0, 0, 1, 1},
+ {&__pyx_n_s__e, __pyx_k__e, sizeof(__pyx_k__e), 0, 0, 1, 1},
{&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
{&__pyx_n_s__encoding, __pyx_k__encoding, sizeof(__pyx_k__encoding), 0, 0, 1, 1},
{&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1},
{&__pyx_n_s__eval, __pyx_k__eval, sizeof(__pyx_k__eval), 0, 0, 1, 1},
{&__pyx_n_s__evaluator, __pyx_k__evaluator, sizeof(__pyx_k__evaluator), 0, 0, 1, 1},
+ {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1},
+ {&__pyx_n_s__formalism, __pyx_k__formalism, sizeof(__pyx_k__formalism), 0, 0, 1, 1},
+ {&__pyx_n_s__fst, __pyx_k__fst, sizeof(__pyx_k__fst), 0, 0, 1, 1},
+ {&__pyx_n_s__genexpr, __pyx_k__genexpr, sizeof(__pyx_k__genexpr), 0, 0, 1, 1},
+ {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1},
{&__pyx_n_s__grammar, __pyx_k__grammar, sizeof(__pyx_k__grammar), 0, 0, 1, 1},
{&__pyx_n_s__hypergraph, __pyx_k__hypergraph, sizeof(__pyx_k__hypergraph), 0, 0, 1, 1},
{&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
+ {&__pyx_n_s__in_edges, __pyx_k__in_edges, sizeof(__pyx_k__in_edges), 0, 0, 1, 1},
+ {&__pyx_n_s__info, __pyx_k__info, sizeof(__pyx_k__info), 0, 0, 1, 1},
{&__pyx_n_s__inp, __pyx_k__inp, sizeof(__pyx_k__inp), 0, 0, 1, 1},
{&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 0, 1, 1},
{&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
{&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1},
+ {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1},
{&__pyx_n_s__label, __pyx_k__label, sizeof(__pyx_k__label), 0, 0, 1, 1},
+ {&__pyx_n_s__lexalign, __pyx_k__lexalign, sizeof(__pyx_k__lexalign), 0, 0, 1, 1},
+ {&__pyx_n_s__lextrans, __pyx_k__lextrans, sizeof(__pyx_k__lextrans), 0, 0, 1, 1},
+ {&__pyx_n_s__lhs, __pyx_k__lhs, sizeof(__pyx_k__lhs), 0, 0, 1, 1},
{&__pyx_n_s__lines, __pyx_k__lines, sizeof(__pyx_k__lines), 0, 0, 1, 1},
{&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
{&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1},
+ {&__pyx_n_s__pb, __pyx_k__pb, sizeof(__pyx_k__pb), 0, 0, 1, 1},
+ {&__pyx_n_s__phrase, __pyx_k__phrase, sizeof(__pyx_k__phrase), 0, 0, 1, 1},
{&__pyx_n_s__plf, __pyx_k__plf, sizeof(__pyx_k__plf), 0, 0, 1, 1},
{&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
{&__pyx_n_s__refs, __pyx_k__refs, sizeof(__pyx_k__refs), 0, 0, 1, 1},
{&__pyx_n_s__replace, __pyx_k__replace, sizeof(__pyx_k__replace), 0, 0, 1, 1},
+ {&__pyx_n_s__scfg, __pyx_k__scfg, sizeof(__pyx_k__scfg), 0, 0, 1, 1},
+ {&__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__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},
{&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1},
+ {&__pyx_n_s__tagger, __pyx_k__tagger, sizeof(__pyx_k__tagger), 0, 0, 1, 1},
{&__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},
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
- __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_NotImplemented = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __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[2]; __pyx_lineno = 105; __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[2]; __pyx_lineno = 102; __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[3]; __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[3]; __pyx_lineno = 21; __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 = 47; __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 = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
@@ -14197,6 +21334,20 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+ /* "_cdec.pyx":9
+ * cdef bytes ret
+ * if isinstance(sentence, unicode):
+ * ret = sentence.encode('utf8') # <<<<<<<<<<<<<<
+ * elif isinstance(sentence, str):
+ * ret = sentence
+ */
+ __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_2);
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__utf8));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
+
/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":76
* elif op == 3: # !=
* return not (x == y)
@@ -14204,96 +21355,51 @@ static int __Pyx_InitCachedConstants(void) {
*
* def __len__(self):
*/
- __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
- PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":17
- * hypergraph.ViterbiESentence(self.hg[0], &trans)
- * cdef str sentence = GetString(trans).c_str()
- * return sentence.decode('utf8') # <<<<<<<<<<<<<<
- *
- * def viterbi_tree(self):
- */
- __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_4);
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":21
- * def viterbi_tree(self):
- * cdef str tree = hypergraph.ViterbiETree(self.hg[0]).c_str()
- * return tree.decode('utf8') # <<<<<<<<<<<<<<
- *
- * def viterbi_source_tree(self):
- */
- __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_5);
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
+ PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":25
- * def viterbi_source_tree(self):
- * cdef str tree = hypergraph.ViterbiFTree(self.hg[0]).c_str()
- * return tree.decode('utf8') # <<<<<<<<<<<<<<
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":2
+ * def _phrase(phrase):
+ * return ' '.join('[%s,%d]' % w if isinstance(w, tuple) else w.encode('utf8') for w in phrase) # <<<<<<<<<<<<<<
*
- * def viterbi_features(self):
+ * cdef class TRule:
*/
- __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_6);
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":42
- * if not derivation: break
- * sentence = GetString(derivation._yield).c_str()
- * yield sentence.decode('utf8') # <<<<<<<<<<<<<<
- * finally:
- * del derivations
- */
- __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_7);
+ __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_9);
__Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":56
- * if not derivation: break
- * tree = GetString(derivation._yield).c_str()
- * yield tree.decode('utf8') # <<<<<<<<<<<<<<
- * finally:
- * del derivations
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":177
+ * elif op == 3: # !=
+ * return not (x == y)
+ * raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<<
+ *
+ * cdef class HypergraphNode:
*/
- __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_8);
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
+ __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_14);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
+ PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
- /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":85
- * for k in range(hypos.size()):
- * sentence = GetString(hypos[0][k].words).c_str()
- * yield sentence.decode('utf8') # <<<<<<<<<<<<<<
- * finally:
- * del hypos
+ /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":214
+ * elif op == 3: # !=
+ * return not (x == y)
+ * raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<<
*/
- __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_9);
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
+ __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_16);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_15));
+ PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_15));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":13
* else:
@@ -14302,12 +21408,12 @@ static int __Pyx_InitCachedConstants(void) {
* if not isinstance(inp, str):
* raise TypeError('Cannot create lattice from %s' % type(inp))
*/
- __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_12);
+ __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_17);
__Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":21
* def __getitem__(self, int index):
@@ -14316,194 +21422,243 @@ static int __Pyx_InitCachedConstants(void) {
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index]
*/
- __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_15);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
- PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_s_14));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":30
- * arc = &arc_vector[i]
- * label = TDConvert(arc.label)
- * arcs.append((label.decode('utf8'), arc.cost, arc.dist2next)) # <<<<<<<<<<<<<<
- * return tuple(arcs)
- *
- */
- __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_16);
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
+ __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_20);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":35
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":34
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs:
*/
- __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_17);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
- PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_14));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
+ __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_21);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":39
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":38
* for (label, cost, dist2next) in arcs:
* if isinstance(label, unicode):
* label = label.encode('utf8') # <<<<<<<<<<<<<<
* arc = new lattice.LatticeArc(TDConvert(<char *>label), cost, dist2next)
* self.lattice[0][index].push_back(arc[0])
*/
- __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_18);
+ __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_22);
__Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":65
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":64
* for i in range(len(self)):
* for label, weight, delta in self[i]:
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) # <<<<<<<<<<<<<<
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
*/
- __pyx_k_tuple_25 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_25);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
- PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_s_23));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_24));
- PyTuple_SET_ITEM(__pyx_k_tuple_25, 1, ((PyObject *)__pyx_kp_s_24));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
+ __pyx_k_tuple_29 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_29);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_27));
+ PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s_27));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
+ PyTuple_SET_ITEM(__pyx_k_tuple_29, 1, ((PyObject *)__pyx_kp_s_28));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_28));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":59
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58
*
* def todot(self):
* def lines(): # <<<<<<<<<<<<<<
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
*/
- __pyx_k_tuple_28 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_28);
+ __pyx_k_tuple_32 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_32);
__Pyx_INCREF(((PyObject *)__pyx_n_s__i));
- PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_n_s__i));
+ PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_n_s__i));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
__Pyx_INCREF(((PyObject *)__pyx_n_s__label));
- PyTuple_SET_ITEM(__pyx_k_tuple_28, 1, ((PyObject *)__pyx_n_s__label));
+ PyTuple_SET_ITEM(__pyx_k_tuple_32, 1, ((PyObject *)__pyx_n_s__label));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__label));
__Pyx_INCREF(((PyObject *)__pyx_n_s__weight));
- PyTuple_SET_ITEM(__pyx_k_tuple_28, 2, ((PyObject *)__pyx_n_s__weight));
+ PyTuple_SET_ITEM(__pyx_k_tuple_32, 2, ((PyObject *)__pyx_n_s__weight));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__weight));
__Pyx_INCREF(((PyObject *)__pyx_n_s__delta));
- PyTuple_SET_ITEM(__pyx_k_tuple_28, 3, ((PyObject *)__pyx_n_s__delta));
+ PyTuple_SET_ITEM(__pyx_k_tuple_32, 3, ((PyObject *)__pyx_n_s__delta));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
- __pyx_k_codeobj_29 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_30, __pyx_n_s__lines, 59, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_29)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
+ __pyx_k_codeobj_33 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_34, __pyx_n_s__lines, 58, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_33)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":68
+ /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":67
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
* return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<<
*/
- __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_32);
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":6
- * cdef bytes ret
- * if isinstance(sentence, unicode):
- * ret = sentence.encode('utf8') # <<<<<<<<<<<<<<
- * elif isinstance(sentence, str):
- * ret = sentence
- */
- __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_34);
+ __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_36);
__Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":89
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":79
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<<
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k]
*/
- __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_36);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_35));
- PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_35));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
+ __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_38);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
+ PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_37));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_37));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
- /* "_cdec.pyx":47
- *
- * def read_weights(self, cfg):
- * with open(cfg) as fp: # <<<<<<<<<<<<<<
+ /* "_cdec.pyx":49
+ * """
+ * if config_str is None:
+ * formalism = config.get('formalism', None) # <<<<<<<<<<<<<<
+ * if formalism not in ('scfg', 'fst', 'lextrans', 'pb',
+ * 'csplit', 'tagger', 'lexalign'):
+ */
+ __pyx_k_tuple_41 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_41);
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__formalism));
+ PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_n_s__formalism));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__formalism));
+ __Pyx_INCREF(Py_None);
+ PyTuple_SET_ITEM(__pyx_k_tuple_41, 1, Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
+
+ /* "_cdec.pyx":87
+ * 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_38 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_38);
+ __pyx_k_tuple_45 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_45);
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_44));
+ PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_kp_s_44));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_44));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));
+
+ /* "_cdec.pyx":85
+ *
+ * def read_weights(self, weights):
+ * with open(weights) as fp: # <<<<<<<<<<<<<<
+ * for line in fp:
+ * if line.strip().startswith('#'): continue
+ */
+ __pyx_k_tuple_46 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_46);
__Pyx_INCREF(Py_None);
- PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, Py_None);
+ PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(Py_None);
- PyTuple_SET_ITEM(__pyx_k_tuple_38, 1, Py_None);
+ PyTuple_SET_ITEM(__pyx_k_tuple_46, 1, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(Py_None);
- PyTuple_SET_ITEM(__pyx_k_tuple_38, 2, Py_None);
+ PyTuple_SET_ITEM(__pyx_k_tuple_46, 2, Py_None);
__Pyx_GIVEREF(Py_None);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
- /* "_cdec.pyx":54
+ /* "_cdec.pyx":93
* def translate(self, sentence, grammar=None):
* if isinstance(sentence, unicode):
* inp = sentence.strip().encode('utf8') # <<<<<<<<<<<<<<
* elif isinstance(sentence, str):
* inp = sentence.strip()
*/
- __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_39);
+ __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_47);
__Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_n_s__utf8));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
-
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":153
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":1
+ * def _phrase(phrase): # <<<<<<<<<<<<<<
+ * return ' '.join('[%s,%d]' % w if isinstance(w, tuple) else w.encode('utf8') for w in phrase)
+ *
+ */
+ __pyx_k_tuple_49 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_49);
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__phrase));
+ PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_n_s__phrase));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__phrase));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__genexpr));
+ PyTuple_SET_ITEM(__pyx_k_tuple_49, 1, ((PyObject *)__pyx_n_s__genexpr));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__genexpr));
+ PyTuple_SET_ITEM(__pyx_k_tuple_49, 2, ((PyObject *)__pyx_n_s__genexpr));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
+ __pyx_k_codeobj_50 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_51, __pyx_n_s___phrase, 1, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_50)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":143
* return self.name.c_str()
*
* BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<<
* TER = Scorer('TER')
*/
- __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_41);
+ __pyx_k_tuple_52 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_52);
__Pyx_INCREF(((PyObject *)__pyx_n_s__IBM_BLEU));
- PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_n_s__IBM_BLEU));
+ PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_n_s__IBM_BLEU));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__IBM_BLEU));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":154
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":144
*
* BLEU = Scorer('IBM_BLEU')
* TER = Scorer('TER') # <<<<<<<<<<<<<<
*/
- __pyx_k_tuple_42 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_42);
+ __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_53);
__Pyx_INCREF(((PyObject *)__pyx_n_s__TER));
- PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_n_s__TER));
+ PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_n_s__TER));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__TER));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
+
+ /* "_cdec.pyx":27
+ * class ParseFailed(Exception): pass
+ *
+ * def _make_config(config): # <<<<<<<<<<<<<<
+ * for key, value in config.items():
+ * if isinstance(value, dict):
+ */
+ __pyx_k_tuple_54 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_k_tuple_54);
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__config));
+ PyTuple_SET_ITEM(__pyx_k_tuple_54, 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_54, 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_54, 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_54, 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_54, 4, ((PyObject *)__pyx_n_s__info));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__info));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
+ __pyx_k_codeobj_55 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_56, __pyx_n_s___make_config, 27, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
@@ -14596,105 +21751,196 @@ PyMODINIT_FUNC PyInit__cdec(void)
if (PyType_Ready(&__pyx_type_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[2]; __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[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_Hypergraph = &__pyx_type_5_cdec_Hypergraph;
+ if (PyType_Ready(&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "TRule", (PyObject *)&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec_TRule = &__pyx_type_5_cdec_TRule;
+ __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[2]; __pyx_lineno = 133; __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[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "HypergraphEdge", (PyObject *)&__pyx_type_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __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[2]; __pyx_lineno = 179; __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[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "HypergraphNode", (PyObject *)&__pyx_type_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __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[3]; __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[3]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_Lattice = &__pyx_type_5_cdec_Lattice;
- if (PyType_Ready(&__pyx_type_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Candidate", (PyObject *)&__pyx_type_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "Candidate", (PyObject *)&__pyx_type_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_Candidate = &__pyx_type_5_cdec_Candidate;
- if (PyType_Ready(&__pyx_type_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "SufficientStats", (PyObject *)&__pyx_type_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "SufficientStats", (PyObject *)&__pyx_type_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_SufficientStats = &__pyx_type_5_cdec_SufficientStats;
- if (PyType_Ready(&__pyx_type_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "CandidateSet", (PyObject *)&__pyx_type_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "CandidateSet", (PyObject *)&__pyx_type_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_CandidateSet = &__pyx_type_5_cdec_CandidateSet;
- if (PyType_Ready(&__pyx_type_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "SegmentEvaluator", (PyObject *)&__pyx_type_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "SegmentEvaluator", (PyObject *)&__pyx_type_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_SegmentEvaluator = &__pyx_type_5_cdec_SegmentEvaluator;
- if (PyType_Ready(&__pyx_type_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Scorer", (PyObject *)&__pyx_type_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "Scorer", (PyObject *)&__pyx_type_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec_Scorer = &__pyx_type_5_cdec_Scorer;
- if (PyType_Ready(&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __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 = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __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 = 38; __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 = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct____iter__ = &__pyx_type_5_cdec___pyx_scope_struct____iter__;
if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_1___iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_1___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_1___iter__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_2_kbest) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_2_kbest) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_2_kbest = &__pyx_type_5_cdec___pyx_scope_struct_2_kbest;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_3_kbest_tree) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_3_kbest_tree = &__pyx_type_5_cdec___pyx_scope_struct_3_kbest_tree;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_4_kbest_features) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_3_kbest_trees) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_3_kbest_trees = &__pyx_type_5_cdec___pyx_scope_struct_3_kbest_trees;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_4_kbest_features) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_4_kbest_features = &__pyx_type_5_cdec___pyx_scope_struct_4_kbest_features;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_5_sample) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_5_sample) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_5_cdec___pyx_scope_struct_5_sample = &__pyx_type_5_cdec___pyx_scope_struct_5_sample;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_6___iter__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_6___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_6___iter__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_7_todot) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_7_todot = &__pyx_type_5_cdec___pyx_scope_struct_7_todot;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_8_lines) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_8_lines = &__pyx_type_5_cdec___pyx_scope_struct_8_lines;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_9___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_9___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_9___iter__;
- if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_10___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_5_cdec___pyx_scope_struct_10___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_10___iter__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_6___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_6___get__ = &__pyx_type_5_cdec___pyx_scope_struct_6___get__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_7___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_7___get__ = &__pyx_type_5_cdec___pyx_scope_struct_7___get__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_8__phrase) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_8__phrase = &__pyx_type_5_cdec___pyx_scope_struct_8__phrase;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_9_genexpr) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_9_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_9_genexpr;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_10___str__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_10___str__ = &__pyx_type_5_cdec___pyx_scope_struct_10___str__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_11_genexpr) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_11_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_11_genexpr;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_12___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __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[2]; __pyx_lineno = 189; __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[2]; __pyx_lineno = 195; __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___iter__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_15___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_15___iter__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_16_todot) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_16_todot = &__pyx_type_5_cdec___pyx_scope_struct_16_todot;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_17_lines) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_17_lines = &__pyx_type_5_cdec___pyx_scope_struct_17_lines;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_18___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __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___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_19___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_19___iter__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_20__make_config) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_20__make_config = &__pyx_type_5_cdec___pyx_scope_struct_20__make_config;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_21___cinit__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_21___cinit__ = &__pyx_type_5_cdec___pyx_scope_struct_21___cinit__;
+ if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_22_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_5_cdec___pyx_scope_struct_22_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_22_genexpr;
/*--- Type import code ---*/
/*--- Variable import code ---*/
/*--- Function import code ---*/
/*--- Execution code ---*/
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":153
+ /* "/Users/vchahun/Sandbox/cdec/python/src/trule.pxi":1
+ * def _phrase(phrase): # <<<<<<<<<<<<<<
+ * return ' '.join('[%s,%d]' % w if isinstance(w, tuple) else w.encode('utf8') for w in phrase)
+ *
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_1_phrase, NULL, __pyx_n_s___cdec); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s___phrase, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":143
* return self.name.c_str()
*
* BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<<
* TER = Scorer('TER')
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_52), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BLEU, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BLEU, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":154
+ /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":144
*
* BLEU = Scorer('IBM_BLEU')
* TER = Scorer('TER') # <<<<<<<<<<<<<<
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "_cdec.pyx":11
+ /* "_cdec.pyx":21
* include "mteval.pxi"
*
* SetSilent(True) # <<<<<<<<<<<<<<
+ * decoder.register_feature_functions()
*
- * class ParseFailed(Exception): pass
*/
SetSilent(1);
- /* "_cdec.pyx":13
+ /* "_cdec.pyx":22
+ *
* SetSilent(True)
+ * decoder.register_feature_functions() # <<<<<<<<<<<<<<
*
- * class ParseFailed(Exception): pass # <<<<<<<<<<<<<<
+ * class InvalidConfig(Exception): pass
+ */
+ register_feature_functions();
+
+ /* "_cdec.pyx":24
+ * decoder.register_feature_functions()
+ *
+ * class InvalidConfig(Exception): pass # <<<<<<<<<<<<<<
+ * class ParseFailed(Exception): pass
*
- * cdef class Decoder:
*/
- __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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 = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_builtin_Exception);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception);
__Pyx_GIVEREF(__pyx_builtin_Exception);
- __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__ParseFailed, __pyx_n_s___cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__InvalidConfig, __pyx_n_s___cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ParseFailed, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__InvalidConfig, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ /* "_cdec.pyx":25
+ *
+ * class InvalidConfig(Exception): pass
+ * class ParseFailed(Exception): pass # <<<<<<<<<<<<<<
+ *
+ * def _make_config(config):
+ */
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __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 = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_builtin_Exception);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_Exception);
+ __Pyx_GIVEREF(__pyx_builtin_Exception);
+ __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1), __pyx_n_s__ParseFailed, __pyx_n_s___cdec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ParseFailed, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+
+ /* "_cdec.pyx":27
+ * class ParseFailed(Exception): pass
+ *
+ * def _make_config(config): # <<<<<<<<<<<<<<
+ * for key, value in config.items():
+ * if isinstance(value, dict):
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_3_make_config, NULL, __pyx_n_s___cdec); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s___make_config, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
/* "_cdec.pyx":1
* from libcpp.string cimport string # <<<<<<<<<<<<<<
* from libcpp.vector cimport vector
@@ -15056,6 +22302,36 @@ static void __Pyx_RaiseArgtupleInvalid(
(num_expected == 1) ? "" : "s", num_found);
}
+static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
+ PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
+}
+
+static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
+ PyObject* next;
+ if (unlikely(!PyIter_Check(iterator))) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s object is not an iterator", iterator->ob_type->tp_name);
+ return NULL;
+ }
+ next = (*(Py_TYPE(iterator)->tp_iternext))(iterator);
+ if (likely(next)) {
+ return next;
+ } else if (defval) {
+ if (PyErr_Occurred()) {
+ if(!PyErr_ExceptionMatches(PyExc_StopIteration))
+ return NULL;
+ PyErr_Clear();
+ }
+ Py_INCREF(defval);
+ return defval;
+ } else if (PyErr_Occurred()) {
+ return NULL;
+ } else {
+ PyErr_SetNone(PyExc_StopIteration);
+ return NULL;
+ }
+}
+
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
"need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
@@ -15085,10 +22361,6 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
-static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
- PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
-}
-
static double __Pyx__PyObject_AsDouble(PyObject* obj) {
PyObject* float_value;
if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) {
@@ -15625,6 +22897,78 @@ static void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple)
Py_INCREF(tuple);
}
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
+ if (s1 == s2) {
+ return (equals == Py_EQ);
+ } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
+ if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
+ return (equals == Py_NE);
+ } else if (PyBytes_GET_SIZE(s1) == 1) {
+ if (equals == Py_EQ)
+ return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
+ else
+ return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
+ } else {
+ int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
+ return (equals == Py_EQ) ? (result == 0) : (result != 0);
+ }
+ } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
+ return (equals == Py_NE);
+ } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
+ return (equals == Py_NE);
+ } else {
+ int result;
+ PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+ if (!py_result)
+ return -1;
+ result = __Pyx_PyObject_IsTrue(py_result);
+ Py_DECREF(py_result);
+ return result;
+ }
+}
+
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
+ if (s1 == s2) {
+ return (equals == Py_EQ);
+ } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
+ #if CYTHON_PEP393_ENABLED
+ if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0))
+ return -1;
+ if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) {
+ return (equals == Py_NE);
+ } else if (PyUnicode_GET_LENGTH(s1) == 1) {
+ Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0);
+ Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0);
+ return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
+ #else
+ if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
+ return (equals == Py_NE);
+ } else if (PyUnicode_GET_SIZE(s1) == 1) {
+ Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0];
+ Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0];
+ return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
+ #endif
+ } else {
+ int result = PyUnicode_Compare(s1, s2);
+ if ((result == -1) && unlikely(PyErr_Occurred()))
+ return -1;
+ return (equals == Py_EQ) ? (result == 0) : (result != 0);
+ }
+ } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
+ return (equals == Py_NE);
+ } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
+ return (equals == Py_NE);
+ } else {
+ int result;
+ PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+ if (!py_result)
+ return -1;
+ result = __Pyx_PyObject_IsTrue(py_result);
+ Py_DECREF(py_result);
+ return result;
+ }
+}
+
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
@@ -16025,6 +23369,25 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
}
}
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+ int lineno, const char *filename) {
+ PyObject *old_exc, *old_val, *old_tb;
+ PyObject *ctx;
+ __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+ #if PY_MAJOR_VERSION < 3
+ ctx = PyString_FromString(name);
+ #else
+ ctx = PyUnicode_FromString(name);
+ #endif
+ __Pyx_ErrRestore(old_exc, old_val, old_tb);
+ if (!ctx) {
+ PyErr_WriteUnraisable(Py_None);
+ } else {
+ PyErr_WriteUnraisable(ctx);
+ Py_DECREF(ctx);
+ }
+}
+
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
@@ -16312,25 +23675,6 @@ static int __pyx_Generator_init(void)
return PyType_Ready(&__pyx_GeneratorType);
}
-static void __Pyx_WriteUnraisable(const char *name, int clineno,
- int lineno, const char *filename) {
- PyObject *old_exc, *old_val, *old_tb;
- PyObject *ctx;
- __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
- #if PY_MAJOR_VERSION < 3
- ctx = PyString_FromString(name);
- #else
- ctx = PyUnicode_FromString(name);
- #endif
- __Pyx_ErrRestore(old_exc, old_val, old_tb);
- if (!ctx) {
- PyErr_WriteUnraisable(Py_None);
- } else {
- PyErr_WriteUnraisable(ctx);
- Py_DECREF(ctx);
- }
-}
-
static int __Pyx_check_binary_version(void) {
char ctversion[4], rtversion[4];
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
@@ -16350,6 +23694,23 @@ static int __Pyx_check_binary_version(void) {
return 0;
}
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+ PyObject *ob = PyCapsule_New(vtable, 0, 0);
+#else
+ PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
+#endif
+ if (!ob)
+ goto bad;
+ if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
+ goto bad;
+ Py_DECREF(ob);
+ return 0;
+bad:
+ Py_XDECREF(ob);
+ return -1;
+}
+
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
int start = 0, mid = 0, end = count - 1;
if (end >= 0 && code_line > entries[end].code_line) {
diff --git a/python/src/_cdec.pyx b/python/src/_cdec.pyx
index cccfec0b..879e8b72 100644
--- a/python/src/_cdec.pyx
+++ b/python/src/_cdec.pyx
@@ -3,22 +3,55 @@ from libcpp.vector cimport vector
from utils cimport *
cimport decoder
+cdef char* as_str(sentence, error_msg='Cannot convert type %s to str'):
+ cdef bytes ret
+ if isinstance(sentence, unicode):
+ ret = sentence.encode('utf8')
+ elif isinstance(sentence, str):
+ ret = sentence
+ else:
+ raise TypeError(error_msg % type(sentence))
+ return ret
+
include "vectors.pxi"
include "hypergraph.pxi"
include "lattice.pxi"
include "mteval.pxi"
SetSilent(True)
+decoder.register_feature_functions()
+class InvalidConfig(Exception): pass
class ParseFailed(Exception): pass
+def _make_config(config):
+ 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):
+ for name in value:
+ yield key, name
+ else:
+ yield key, bytes(value)
+
cdef class Decoder:
cdef decoder.Decoder* dec
cdef DenseVector weights
- def __cinit__(self, char* config):
- decoder.register_feature_functions()
- cdef istringstream* config_stream = new istringstream(config)
+ def __cinit__(self, config_str=None, **config):
+ """ Configuration can be given as a string:
+ Decoder('formalism = scfg')
+ or using keyword arguments:
+ Decoder(formalism='scfg')
+ """
+ if config_str is None:
+ formalism = config.get('formalism', None)
+ 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)
self.dec = new decoder.Decoder(config_stream)
del config_stream
self.weights = DenseVector()
@@ -43,9 +76,15 @@ cdef class Decoder:
else:
raise TypeError('cannot initialize weights with %s' % type(weights))
- def read_weights(self, cfg):
- with open(cfg) as fp:
+ property formalism:
+ def __get__(self):
+ cdef variables_map* conf = &self.dec.GetConf()
+ return conf[0]['formalism'].as_str().c_str()
+
+ def read_weights(self, weights):
+ with open(weights) as fp:
for line in fp:
+ if line.strip().startswith('#'): continue
fname, value = line.split()
self.weights[fname.strip()] = float(value)
diff --git a/python/src/decoder.pxd b/python/src/decoder.pxd
index e2678151..660bcb39 100644
--- a/python/src/decoder.pxd
+++ b/python/src/decoder.pxd
@@ -1,7 +1,7 @@
from libcpp.string cimport string
from libcpp.vector cimport vector
from hypergraph cimport Hypergraph
-from utils cimport istream, weight_t
+from utils cimport istream, weight_t, variables_map
cdef extern from "decoder/ff_register.h":
void register_feature_functions()
@@ -23,7 +23,7 @@ cdef extern from "decoder/decoder.h":
vector[weight_t]& CurrentWeightVector()
# void SetId(int id)
- # const boost::program_options::variables_map& GetConf() const { return conf }
+ variables_map& GetConf()
# add grammar rules (currently only supported by SCFG decoders)
# that will be used on subsequent calls to Decode. rules should be in standard
diff --git a/python/src/hypergraph.pxd b/python/src/hypergraph.pxd
index 656b1d47..14c60dd0 100644
--- a/python/src/hypergraph.pxd
+++ b/python/src/hypergraph.pxd
@@ -3,32 +3,43 @@ from libcpp.vector cimport vector
from utils cimport *
from lattice cimport Lattice
+cdef extern from "decoder/trule.h":
+ cdef cppclass TRule:
+ vector[WordID] f_
+ vector[WordID] e_
+ FastSparseVector[weight_t] scores_
+ WordID lhs_
+ int arity_
+ bint IsUnary()
+ bint IsGoal()
+
cdef extern from "decoder/hg.h":
cdef cppclass EdgeMask "std::vector<bool>":
EdgeMask(int size)
bint& operator[](int)
+ cdef cppclass HypergraphEdge "const Hypergraph::Edge":
+ int id_
+ int head_node_ # position in hg.nodes_
+ SmallVector[unsigned] tail_nodes_ # positions in hg.nodes_
+ shared_ptr[TRule] rule_
+ FastSparseVector[weight_t] feature_values_
+ LogVal[double] edge_prob_ # weights.dot(feature_values_)
+ # typically source span:
+ short int i_
+ short int j_
+
+ cdef cppclass HypergraphNode "const Hypergraph::Node":
+ int id_
+ WordID cat_ # non-terminal category if <0, 0 if not set
+ vector[int] in_edges_ # positions in hg.edge_prob_
+ vector[int] out_edges_ # positions in hg.edge_prob_
+
cdef cppclass Hypergraph:
- cppclass Edge:
- int id_
- int head_node_ # position in hg.nodes_
- SmallVector[unsigned] tail_nodes_ # positions in hg.nodes_
- #TRulePtr rule_
- FastSparseVector[weight_t] feature_values_
- LogVal[double] edge_prob_
- short int i_
- short int j_
- short int prev_i_
- short int prev_j_
- cppclass Node:
- int id_
- WordID cat_
- WordID NT()
- vector[Edge] in_edges_
- vector[Edge] out_edges_
Hypergraph(Hypergraph)
- vector[Node] nodes_
- vector[Edge] edges_
+ vector[HypergraphNode] nodes_
+ vector[HypergraphEdge] edges_
+ int GoalNode()
void Reweight(vector[weight_t]& weights)
void Reweight(FastSparseVector& weights)
bint PruneInsideOutside(double beam_alpha,
@@ -47,6 +58,7 @@ cdef extern from "decoder/viterbi.h":
FastSparseVector[weight_t] ViterbiFeatures(Hypergraph& hg,
FastSparseVector[weight_t]* weights,
bint fatal_dotprod_disagreement)
+ string JoshuaVisualizationString(Hypergraph& hg)
cdef extern from "decoder/hg_io.h" namespace "HypergraphIO":
bint ReadFromJSON(istream* inp, Hypergraph* out)
@@ -62,7 +74,7 @@ cdef extern from "decoder/hg_intersect.h" namespace "HG":
cdef extern from "decoder/hg_sampler.h" namespace "HypergraphSampler":
cdef cppclass Hypothesis:
vector[WordID] words
- FastSparseVector[double] fmap
+ FastSparseVector[weight_t] fmap
LogVal[double] model_score
void sample_hypotheses(Hypergraph& hg,
unsigned n,
diff --git a/python/src/hypergraph.pxi b/python/src/hypergraph.pxi
index 9d09722e..2e2c04a2 100644
--- a/python/src/hypergraph.pxi
+++ b/python/src/hypergraph.pxi
@@ -1,5 +1,5 @@
cimport hypergraph
-cimport kbest as kb
+cimport kbest
cdef class Hypergraph:
cdef hypergraph.Hypergraph* hg
@@ -13,53 +13,54 @@ cdef class Hypergraph:
def viterbi(self):
cdef vector[WordID] trans
hypergraph.ViterbiESentence(self.hg[0], &trans)
- cdef str sentence = GetString(trans).c_str()
- return sentence.decode('utf8')
+ return unicode(GetString(trans).c_str(), 'utf8')
- def viterbi_tree(self):
- cdef str tree = hypergraph.ViterbiETree(self.hg[0]).c_str()
- return tree.decode('utf8')
-
- def viterbi_source_tree(self):
- cdef str tree = hypergraph.ViterbiFTree(self.hg[0]).c_str()
- return tree.decode('utf8')
+ 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)
def viterbi_features(self):
cdef SparseVector fmap = SparseVector()
fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
return fmap
+ def viterbi_joshua(self):
+ return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
+
def kbest(self, size):
- cdef kb.KBestDerivations[vector[WordID], kb.ESentenceTraversal]* derivations = new kb.KBestDerivations[vector[WordID], kb.ESentenceTraversal](self.hg[0], size)
- cdef kb.KBestDerivations[vector[WordID], kb.ESentenceTraversal].Derivation* derivation
- cdef bytes sentence
+ 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
try:
for k in range(size):
derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
if not derivation: break
- sentence = GetString(derivation._yield).c_str()
- yield sentence.decode('utf8')
+ yield unicode(GetString(derivation._yield).c_str(), 'utf8')
finally:
del derivations
- def kbest_tree(self, size):
- cdef kb.KBestDerivations[vector[WordID], kb.ETreeTraversal]* derivations = new kb.KBestDerivations[vector[WordID], kb.ETreeTraversal](self.hg[0], size)
- cdef kb.KBestDerivations[vector[WordID], kb.ETreeTraversal].Derivation* derivation
- cdef str tree
+ 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)
+ cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal].Derivation* e_derivation
cdef unsigned k
try:
for k in range(size):
- derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
- if not derivation: break
- tree = GetString(derivation._yield).c_str()
- yield tree.decode('utf8')
+ 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
+ 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 derivations
+ del f_derivations
+ del e_derivations
def kbest_features(self, size):
- cdef kb.KBestDerivations[FastSparseVector[weight_t], kb.FeatureVectorTraversal]* derivations = new kb.KBestDerivations[FastSparseVector[weight_t], kb.FeatureVectorTraversal](self.hg[0], size)
- cdef kb.KBestDerivations[FastSparseVector[weight_t], kb.FeatureVectorTraversal].Derivation* derivation
+ 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
cdef unsigned k
try:
@@ -77,17 +78,13 @@ cdef class Hypergraph:
if self.rng == NULL:
self.rng = new MT19937()
hypergraph.sample_hypotheses(self.hg[0], n, self.rng, hypos)
- cdef str sentence
cdef unsigned k
try:
for k in range(hypos.size()):
- sentence = GetString(hypos[0][k].words).c_str()
- yield sentence.decode('utf8')
+ yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8')
finally:
del hypos
- # TODO richer k-best/sample output (feature vectors, trees?)
-
def intersect(self, Lattice lat):
return hypergraph.Intersect(lat.lattice[0], self.hg)
@@ -113,3 +110,105 @@ cdef class Hypergraph:
raise TypeError('cannot reweight hypergraph with %s' % type(weights))
# TODO get feature expectations, get partition function ("inside" score)
+
+ property edges:
+ def __get__(self):
+ cdef unsigned i
+ for i in range(self.hg.edges_.size()):
+ yield HypergraphEdge().init(self.hg, i)
+
+ property nodes:
+ def __get__(self):
+ cdef unsigned i
+ for i in range(self.hg.nodes_.size()):
+ yield HypergraphNode().init(self.hg, i)
+
+ property goal:
+ def __get__(self):
+ return HypergraphNode().init(self.hg, self.hg.GoalNode())
+
+
+include "trule.pxi"
+
+cdef class HypergraphEdge:
+ cdef hypergraph.Hypergraph* hg
+ cdef hypergraph.HypergraphEdge* edge
+ cdef public TRule trule
+
+ cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
+ self.hg = hg
+ self.edge = &hg.edges_[i]
+ self.trule = TRule()
+ self.trule.rule = self.edge.rule_.get()
+ return self
+
+ def __len__(self):
+ return self.edge.tail_nodes_.size()
+
+ property head_node:
+ def __get__(self):
+ return HypergraphNode().init(self.hg, self.edge.head_node_)
+
+ property tail_nodes:
+ def __get__(self):
+ cdef unsigned i
+ for i in range(self.edge.tail_nodes_.size()):
+ yield HypergraphNode().init(self.hg, self.edge.tail_nodes_[i])
+
+ property span:
+ def __get__(self):
+ return (self.edge.i_, self.edge.j_)
+
+ property feature_values:
+ def __get__(self):
+ cdef SparseVector vector = SparseVector()
+ vector.vector = new FastSparseVector[double](self.edge.feature_values_)
+ return vector
+
+ property prob:
+ def __get__(self):
+ return self.edge.edge_prob_.as_float()
+
+ def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
+ if op == 2: # ==
+ return x.edge == y.edge
+ elif op == 3: # !=
+ return not (x == y)
+ raise NotImplemented('comparison not implemented for HypergraphEdge')
+
+cdef class HypergraphNode:
+ cdef hypergraph.Hypergraph* hg
+ cdef hypergraph.HypergraphNode* node
+
+ cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
+ self.hg = hg
+ self.node = &hg.nodes_[i]
+ return self
+
+ property in_edges:
+ def __get__(self):
+ 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:
+ def __get__(self):
+ cdef unsigned i
+ for i in range(self.node.out_edges_.size()):
+ yield HypergraphEdge().init(self.hg, self.node.out_edges_[i])
+
+ property span:
+ def __get__(self):
+ return next(self.in_edges).span
+
+ property cat:
+ def __get__(self):
+ if self.node.cat_:
+ return TDConvert(-self.node.cat_)
+
+ def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
+ if op == 2: # ==
+ return x.node == y.node
+ elif op == 3: # !=
+ return not (x == y)
+ raise NotImplemented('comparison not implemented for HypergraphNode')
diff --git a/python/src/lattice.pxi b/python/src/lattice.pxi
index f8341e29..c6b29e8b 100644
--- a/python/src/lattice.pxi
+++ b/python/src/lattice.pxi
@@ -22,12 +22,11 @@ cdef class Lattice:
arcs = []
cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index]
cdef lattice.LatticeArc* arc
- cdef str label
cdef unsigned i
for i in range(arc_vector.size()):
arc = &arc_vector[i]
- label = TDConvert(arc.label)
- arcs.append((label.decode('utf8'), arc.cost, arc.dist2next))
+ label = unicode(TDConvert(arc.label), 'utf8')
+ arcs.append((label, arc.cost, arc.dist2next))
return tuple(arcs)
def __setitem__(self, int index, tuple arcs):
diff --git a/python/src/mteval.pxi b/python/src/mteval.pxi
index d90eb9a6..4ba73168 100644
--- a/python/src/mteval.pxi
+++ b/python/src/mteval.pxi
@@ -1,15 +1,5 @@
cimport mteval
-cdef char* as_str(sentence, error_msg='Cannot convert type %s to str'):
- cdef bytes ret
- if isinstance(sentence, unicode):
- ret = sentence.encode('utf8')
- elif isinstance(sentence, str):
- ret = sentence
- else:
- raise TypeError(error_msg % type(sentence))
- return ret
-
cdef SufficientStats as_stats(x, y):
if isinstance(x, SufficientStats):
return x
diff --git a/python/src/trule.pxi b/python/src/trule.pxi
new file mode 100644
index 00000000..6168014d
--- /dev/null
+++ b/python/src/trule.pxi
@@ -0,0 +1,55 @@
+def _phrase(phrase):
+ return ' '.join('[%s,%d]' % w if isinstance(w, tuple) else w.encode('utf8') for w in phrase)
+
+cdef class TRule:
+ cdef hypergraph.TRule* rule
+
+ property arity:
+ def __get__(self):
+ return self.rule.arity_
+
+ property f:
+ def __get__(self):
+ cdef vector[WordID]* f = &self.rule.f_
+ cdef WordID w
+ cdef words = []
+ cdef unsigned i
+ cdef int idx = 0
+ for i in range(f.size()):
+ w = f[0][i]
+ if w < 0:
+ idx += 1
+ words.append((TDConvert(-w), idx))
+ else:
+ words.append(unicode(TDConvert(w), encoding='utf8'))
+ return words
+
+ property e:
+ def __get__(self):
+ cdef vector[WordID]* e = &self.rule.e_
+ cdef WordID w
+ cdef words = []
+ cdef unsigned i
+ cdef int idx = 0
+ for i in range(e.size()):
+ w = e[0][i]
+ if w < 1:
+ idx += 1
+ words.append((TDConvert(1-w), idx))
+ else:
+ words.append(unicode(TDConvert(w), encoding='utf8'))
+ return words
+
+ property scores:
+ def __get__(self):
+ cdef SparseVector scores = SparseVector()
+ scores.vector = new FastSparseVector[double](self.rule.scores_)
+ return scores
+
+ property lhs:
+ def __get__(self):
+ return TDConvert(-self.rule.lhs_)
+
+ def __str__(self):
+ scores = ' '.join('%s=%s' % feat for feat in self.scores)
+ return '[%s] ||| %s ||| %s ||| %s' % (self.lhs, _phrase(self.f), _phrase(self.e), scores)
diff --git a/python/src/utils.pxd b/python/src/utils.pxd
index 94fab5ef..15e77c49 100644
--- a/python/src/utils.pxd
+++ b/python/src/utils.pxd
@@ -9,7 +9,6 @@ cdef extern from "<iostream>" namespace "std":
pass
cdef cppclass istringstream(istream):
istringstream(char*)
- ostream cout
cdef extern from "utils/weights.h":
ctypedef double weight_t
@@ -25,7 +24,8 @@ cdef extern from "utils/wordid.h":
cdef extern from "utils/small_vector.h":
cdef cppclass SmallVector[T]:
- pass
+ T& operator[](unsigned)
+ unsigned size()
cdef extern from "utils/sparse_vector.h":
cdef cppclass FastSparseVector[T]:
@@ -84,3 +84,11 @@ cdef extern from "<boost/shared_ptr.hpp>" namespace "boost":
cdef cppclass shared_ptr[T]:
shared_ptr(shared_ptr& r)
T* get()
+
+cdef extern from "<boost/program_options.hpp>":
+ cdef cppclass variable_value "const boost::program_options::variable_value":
+ string as_str "as<std::string>" ()
+
+ cdef cppclass variables_map "const boost::program_options::variables_map":
+ unsigned count(char* name)
+ variable_value& operator[](char* name)
diff --git a/python/test.py b/python/test.py
index 8069aa0a..54859e81 100644
--- a/python/test.py
+++ b/python/test.py
@@ -2,12 +2,11 @@
import cdec
import gzip
-config = 'formalism=scfg'
weights = '../tests/system_tests/australia/weights'
grammar_file = '../tests/system_tests/australia/australia.scfg.gz'
# Load decoder width configuration
-decoder = cdec.Decoder(config)
+decoder = cdec.Decoder(formalism='scfg')
# Read weights
decoder.read_weights(weights)
@@ -26,15 +25,17 @@ forest = decoder.translate(sentence, grammar=grammar)
# Get viterbi translation
print 'Output[0]:', forest.viterbi().encode('utf8')
-print ' ETree[0]:', forest.viterbi_tree().encode('utf8')
-print ' FTree[0]:', forest.viterbi_source_tree().encode('utf8')
+f_tree, e_tree = forest.viterbi_trees()
+print ' FTree[0]:', f_tree.encode('utf8')
+print ' ETree[0]:', e_tree.encode('utf8')
print 'LgProb[0]:', forest.viterbi_features().dot(decoder.weights)
# Get k-best translations
-kbest = zip(forest.kbest(5), forest.kbest_tree(5), forest.kbest_features(5))
-for i, (sentence, tree, features) in enumerate(kbest, 1):
+kbest = zip(forest.kbest(5), forest.kbest_trees(5), forest.kbest_features(5))
+for i, (sentence, (f_tree, e_tree), features) in enumerate(kbest, 1):
print 'Output[%d]:' % i, sentence.encode('utf8')
- print ' Tree[%d]:' % i, tree.encode('utf8')
+ print ' FTree[%d]:' % i, f_tree.encode('utf8')
+ print ' ETree[%d]:' % i, e_tree.encode('utf8')
print ' FVect[%d]:' % i, dict(features)
# Sample translations from the forest
@@ -54,8 +55,9 @@ assert (lattice == tuple(lat))
assert forest.intersect(lat)
# Get best synchronous parse
-print forest.viterbi_tree()
-print forest.viterbi_source_tree()
+f_tree, e_tree = forest.viterbi_trees()
+print 'FTree:', f_tree.encode('utf8')
+print 'ETree:', e_tree.encode('utf8')
# Compare 1best and reference feature vectors
fref = forest.viterbi_features()