diff options
author | Chris Dyer <redpony@gmail.com> | 2014-01-15 20:33:07 -0500 |
---|---|---|
committer | Chris Dyer <redpony@gmail.com> | 2014-01-15 20:33:07 -0500 |
commit | aa5520768619eb15e0c1c70addbfaff0f150c345 (patch) | |
tree | b81fa2e3d1ae3e79ece18024aae6a499f4d3f3ea | |
parent | b1628d8bedb8a4145c77ed5917999379fc99a5d5 (diff) | |
parent | 0ddc951bc8990c1253e6a873848ed69321615e0a (diff) |
Merge branch 'master' of https://github.com/redpony/cdec
-rw-r--r-- | decoder/cdec_ff.cc | 1 | ||||
-rw-r--r-- | decoder/ff_rules.cc | 23 | ||||
-rw-r--r-- | decoder/ff_rules.h | 13 | ||||
-rw-r--r-- | python/cdec/_cdec.cpp | 1468 | ||||
-rw-r--r-- | python/cdec/hypergraph.pxi | 4 | ||||
-rw-r--r-- | training/crf/mpi_adagrad_optimize.cc | 14 | ||||
-rw-r--r-- | training/dtrain/dtrain.cc | 32 | ||||
-rw-r--r-- | training/dtrain/dtrain.h | 2 | ||||
-rw-r--r-- | training/dtrain/examples/standard/cdec.ini | 1 | ||||
-rw-r--r-- | training/dtrain/examples/standard/dtrain.ini | 2 | ||||
-rw-r--r-- | training/dtrain/examples/standard/expected-output | 116 | ||||
-rw-r--r-- | training/dtrain/pairsampling.h | 1 | ||||
-rw-r--r-- | training/dtrain/score.cc | 18 | ||||
-rw-r--r-- | training/dtrain/score.h | 18 |
14 files changed, 914 insertions, 799 deletions
diff --git a/decoder/cdec_ff.cc b/decoder/cdec_ff.cc index d586c1d1..b2541722 100644 --- a/decoder/cdec_ff.cc +++ b/decoder/cdec_ff.cc @@ -45,6 +45,7 @@ void register_feature_functions() { ff_registry.Register("NgramFeatures", new FFFactory<NgramDetector>()); ff_registry.Register("RuleContextFeatures", new FFFactory<RuleContextFeatures>()); ff_registry.Register("RuleIdentityFeatures", new FFFactory<RuleIdentityFeatures>()); + ff_registry.Register("RuleWordAlignmentFeatures", new FFFactory<RuleWordAlignmentFeatures>()); ff_registry.Register("ParseMatchFeatures", new FFFactory<ParseMatchFeatures>); ff_registry.Register("SoftSyntaxFeatures", new FFFactory<SoftSyntaxFeatures>); ff_registry.Register("SoftSyntaxFeaturesMindist", new FFFactory<SoftSyntaxFeaturesMindist>); diff --git a/decoder/ff_rules.cc b/decoder/ff_rules.cc index 410e083c..7bccf084 100644 --- a/decoder/ff_rules.cc +++ b/decoder/ff_rules.cc @@ -12,6 +12,7 @@ #include "verbose.h" #include "tdict.h" #include "hg.h" +#include "trule.h" using namespace std; @@ -68,6 +69,28 @@ void RuleIdentityFeatures::TraversalFeaturesImpl(const SentenceMetadata& smeta, features->add_value(it->second, 1); } +RuleWordAlignmentFeatures::RuleWordAlignmentFeatures(const std::string& param) { +} + +void RuleWordAlignmentFeatures::PrepareForInput(const SentenceMetadata& smeta) { +} + +void RuleWordAlignmentFeatures::TraversalFeaturesImpl(const SentenceMetadata& smeta, + const Hypergraph::Edge& edge, + const vector<const void*>& ant_contexts, + SparseVector<double>* features, + SparseVector<double>* estimated_features, + void* context) const { + const TRule& rule = *edge.rule_; + ostringstream os; + vector<AlignmentPoint> als = rule.als(); + std::vector<AlignmentPoint>::const_iterator xx = als.begin(); + for (; xx != als.end(); ++xx) { + os << "WA:" << TD::Convert(rule.f_[xx->s_]) << ":" << TD::Convert(rule.e_[xx->t_]); + } + features->add_value(FD::Convert(Escape(os.str())), 1); +} + RuleSourceBigramFeatures::RuleSourceBigramFeatures(const std::string& param) { } diff --git a/decoder/ff_rules.h b/decoder/ff_rules.h index f210dc65..324d7a39 100644 --- a/decoder/ff_rules.h +++ b/decoder/ff_rules.h @@ -24,6 +24,19 @@ class RuleIdentityFeatures : public FeatureFunction { mutable std::map<const TRule*, int> rule2_fid_; }; +class RuleWordAlignmentFeatures : public FeatureFunction { + public: + RuleWordAlignmentFeatures(const std::string& param); + protected: + virtual void TraversalFeaturesImpl(const SentenceMetadata& smeta, + const HG::Edge& edge, + const std::vector<const void*>& ant_contexts, + SparseVector<double>* features, + SparseVector<double>* estimated_features, + void* context) const; + virtual void PrepareForInput(const SentenceMetadata& smeta); +}; + class RuleSourceBigramFeatures : public FeatureFunction { public: RuleSourceBigramFeatures(const std::string& param); diff --git a/python/cdec/_cdec.cpp b/python/cdec/_cdec.cpp index 4ef9bdba..ef203fd9 100644 --- a/python/cdec/_cdec.cpp +++ b/python/cdec/_cdec.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Tue Sep 24 13:39:57 2013 */ +/* Generated by Cython 0.19.1 on Fri Nov 15 21:03:05 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -607,7 +607,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector { }; -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":90 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":90 * return candidate * * def __iter__(self): # <<<<<<<<<<<<<< @@ -623,7 +623,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ { }; -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":3 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":3 * from cython.operator cimport preincrement as pinc * * cdef class DenseVector: # <<<<<<<<<<<<<< @@ -637,7 +637,7 @@ struct __pyx_obj_4cdec_5_cdec_DenseVector { }; -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":26 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":26 * return fmap * * cdef class SufficientStats: # <<<<<<<<<<<<<< @@ -651,7 +651,7 @@ struct __pyx_obj_4cdec_5_cdec_SufficientStats { }; -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":49 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":49 * return TRule(lhs, f, e, scores, a) * * cdef class TRule: # <<<<<<<<<<<<<< @@ -664,7 +664,7 @@ struct __pyx_obj_4cdec_5_cdec_TRule { }; -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":177 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":177 * _phrase(self.f), _phrase(self.e), scores) * * cdef class MRule(TRule): # <<<<<<<<<<<<<< @@ -676,7 +676,7 @@ struct __pyx_obj_4cdec_5_cdec_MRule { }; -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":44 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":44 * return self.stats.size() * * def __iter__(self): # <<<<<<<<<<<<<< @@ -693,7 +693,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ { }; -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":176 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":176 * out.fields[i] = ss[i] * * cdef class Metric: # <<<<<<<<<<<<<< @@ -723,7 +723,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_IntList { }; -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":48 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":48 * return sparse * * cdef class SparseVector: # <<<<<<<<<<<<<< @@ -736,7 +736,7 @@ struct __pyx_obj_4cdec_5_cdec_SparseVector { }; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":216 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":216 * * property tail_nodes: * def __get__(self): # <<<<<<<<<<<<<< @@ -752,7 +752,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ { }; -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":8 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":8 * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) * * cdef class NT: # <<<<<<<<<<<<<< @@ -766,7 +766,7 @@ struct __pyx_obj_4cdec_5_cdec_NT { }; -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":3 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":3 * cimport lattice * * cdef class Lattice: # <<<<<<<<<<<<<< @@ -802,7 +802,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config { }; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":196 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":196 * return vector * * cdef class HypergraphEdge: # <<<<<<<<<<<<<< @@ -818,7 +818,7 @@ struct __pyx_obj_4cdec_5_cdec_HypergraphEdge { }; -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":5 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":5 * import cdec.sa._sa as _sa * * def _phrase(phrase): # <<<<<<<<<<<<<< @@ -831,7 +831,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase { }; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":161 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":161 * * property edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -865,7 +865,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Rule { }; -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":63 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":63 * def todot(self): * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" * def lines(): # <<<<<<<<<<<<<< @@ -888,7 +888,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines { }; -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":121 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":121 * return CandidateSet(self) * * cdef class Scorer: # <<<<<<<<<<<<<< @@ -902,7 +902,7 @@ struct __pyx_obj_4cdec_5_cdec_Scorer { }; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":246 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":246 * raise NotImplemented('comparison not implemented for HypergraphEdge') * * cdef class HypergraphNode: # <<<<<<<<<<<<<< @@ -917,7 +917,7 @@ struct __pyx_obj_4cdec_5_cdec_HypergraphNode { }; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":81 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":81 * del e_derivations * * def kbest_features(self, size): # <<<<<<<<<<<<<< @@ -937,7 +937,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features { }; -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":21 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":21 * return '[%s]' % self.cat * * cdef class NTRef: # <<<<<<<<<<<<<< @@ -950,7 +950,7 @@ struct __pyx_obj_4cdec_5_cdec_NTRef { }; -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":193 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":193 * super(MRule, self).__init__(lhs, rhs, e, scores, None) * * cdef class Grammar: # <<<<<<<<<<<<<< @@ -963,7 +963,7 @@ struct __pyx_obj_4cdec_5_cdec_Grammar { }; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":4 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":4 * cimport kbest * * cdef class Hypergraph: # <<<<<<<<<<<<<< @@ -991,7 +991,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ { }; -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":65 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":65 * return result * * cdef class CandidateSet: # <<<<<<<<<<<<<< @@ -1023,7 +1023,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_FloatList { }; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":62 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":62 * del derivations * * def kbest_trees(self, size): # <<<<<<<<<<<<<< @@ -1046,7 +1046,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees { }; -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":61 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":61 * yield self[i] * * def todot(self): # <<<<<<<<<<<<<< @@ -1059,7 +1059,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot { }; -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":172 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":172 * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat) * * def __str__(self): # <<<<<<<<<<<<<< @@ -1072,7 +1072,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ { }; -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":100 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":100 * self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get()) * * cdef class SegmentEvaluator: # <<<<<<<<<<<<<< @@ -1086,7 +1086,7 @@ struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator { }; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":256 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":260 * * property in_edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -1119,7 +1119,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr { }; -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":6 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":6 * * def _phrase(phrase): * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<< @@ -1136,7 +1136,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr { }; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":97 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":97 * del derivations * * def sample(self, unsigned n): # <<<<<<<<<<<<<< @@ -1154,7 +1154,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample { }; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":49 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":49 * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') * * def kbest(self, size): # <<<<<<<<<<<<<< @@ -1173,7 +1173,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest { }; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":167 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":167 * * property nodes: * def __get__(self): # <<<<<<<<<<<<<< @@ -1206,7 +1206,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Phrase { }; -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":199 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":199 * del self.grammar * * def __iter__(self): # <<<<<<<<<<<<<< @@ -1225,7 +1225,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ { }; -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":217 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":217 * self.grammar.get().SetGrammarName(name) * * cdef class TextGrammar(Grammar): # <<<<<<<<<<<<<< @@ -1251,7 +1251,7 @@ struct __pyx_obj_4cdec_5_cdec_Decoder { }; -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":12 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":12 * return stats * * cdef class Candidate: # <<<<<<<<<<<<<< @@ -1265,7 +1265,7 @@ struct __pyx_obj_4cdec_5_cdec_Candidate { }; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":262 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":266 * * property out_edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -1281,7 +1281,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ { }; -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":56 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":56 * return unicode(str(self), 'utf8') * * def __iter__(self): # <<<<<<<<<<<<<< @@ -1297,7 +1297,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__ { }; -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":32 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":32 * self.vector[0][fid] = value * * def __iter__(self): # <<<<<<<<<<<<<< @@ -1313,7 +1313,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ { }; -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":173 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":173 * * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<< @@ -1330,7 +1330,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr { }; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":108 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":108 * del hypos * * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<< @@ -1348,7 +1348,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees { }; -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":131 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":131 * * property a: * def __get__(self): # <<<<<<<<<<<<<< @@ -1365,7 +1365,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ { }; -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":72 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":72 * self.vector.set_value(fid, value) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -1383,7 +1383,7 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ { -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":246 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":246 * raise NotImplemented('comparison not implemented for HypergraphEdge') * * cdef class HypergraphNode: # <<<<<<<<<<<<<< @@ -1397,7 +1397,7 @@ struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode { static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *__pyx_vtabptr_4cdec_5_cdec_HypergraphNode; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":196 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":196 * return vector * * cdef class HypergraphEdge: # <<<<<<<<<<<<<< @@ -1462,7 +1462,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase { static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *__pyx_vtabptr_4cdec_2sa_3_sa_Phrase; -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":4 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":4 * cimport kbest * * cdef class Hypergraph: # <<<<<<<<<<<<<< @@ -2086,6 +2086,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ static int __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_2__set__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ static int __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_2id___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_9out_edges___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self); /* proto */ @@ -2212,7 +2213,7 @@ static char __pyx_k_26[] = "digraph lattice {"; static char __pyx_k_31[] = "\\\""; static char __pyx_k_33[] = "%d [shape=doublecircle]"; static char __pyx_k_34[] = "}"; -static char __pyx_k_37[] = "/home/mdenkows/cdec/python/cdec/lattice.pxi"; +static char __pyx_k_37[] = "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi"; static char __pyx_k_38[] = "Lattice.todot.<locals>.lines"; static char __pyx_k_39[] = "cdec._cdec"; static char __pyx_k_40[] = "\n"; @@ -2226,8 +2227,8 @@ static char __pyx_k_50[] = "#"; static char __pyx_k_53[] = "Cannot translate input type %s"; static char __pyx_k_54[] = "cdec.sa._sa"; static char __pyx_k_55[] = "*"; -static char __pyx_k_58[] = "/home/mdenkows/cdec/python/cdec/grammar.pxi"; -static char __pyx_k_66[] = "/home/mdenkows/cdec/python/cdec/_cdec.pyx"; +static char __pyx_k_58[] = "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi"; +static char __pyx_k_66[] = "/home/pks/src/cdec-dtrain/python/cdec/_cdec.pyx"; static char __pyx_k__a[] = "a"; static char __pyx_k__e[] = "e"; static char __pyx_k__f[] = "f"; @@ -2664,7 +2665,7 @@ static int __pyx_pw_4cdec_5_cdec_11DenseVector_1__init__(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":7 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":7 * cdef bint owned # if True, do not manage memory * * def __init__(self): # <<<<<<<<<<<<<< @@ -2681,7 +2682,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector___init__(struct __pyx_obj_4cdec_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":9 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":9 * def __init__(self): * """DenseVector() -> Dense weight/feature vector.""" * self.vector = new vector[weight_t]() # <<<<<<<<<<<<<< @@ -2696,7 +2697,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector___init__(struct __pyx_obj_4cdec_5 } __pyx_v_self->vector = __pyx_t_1; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":10 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":10 * """DenseVector() -> Dense weight/feature vector.""" * self.vector = new vector[weight_t]() * self.owned = False # <<<<<<<<<<<<<< @@ -2724,7 +2725,7 @@ static void __pyx_pw_4cdec_5_cdec_11DenseVector_3__dealloc__(PyObject *__pyx_v_s __Pyx_RefNannyFinishContext(); } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":12 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":12 * self.owned = False * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2737,7 +2738,7 @@ static void __pyx_pf_4cdec_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_4c int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":13 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":13 * * def __dealloc__(self): * if not self.owned: # <<<<<<<<<<<<<< @@ -2747,7 +2748,7 @@ static void __pyx_pf_4cdec_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_4c __pyx_t_1 = ((!(__pyx_v_self->owned != 0)) != 0); if (__pyx_t_1) { - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":14 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":14 * def __dealloc__(self): * if not self.owned: * del self.vector # <<<<<<<<<<<<<< @@ -2773,7 +2774,7 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__(PyObject *__pyx_v return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":16 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":16 * del self.vector * * def __len__(self): # <<<<<<<<<<<<<< @@ -2786,7 +2787,7 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_11DenseVector_4__len__(struct __pyx_obj_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":17 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":17 * * def __len__(self): * return self.vector.size() # <<<<<<<<<<<<<< @@ -2826,7 +2827,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_7__getitem__(PyObject *__py return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":19 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":19 * return self.vector.size() * * def __getitem__(self, char* fname): # <<<<<<<<<<<<<< @@ -2847,7 +2848,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":20 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":20 * * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -2856,7 +2857,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":21 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":21 * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) * if 0 <= fid < self.vector.size(): # <<<<<<<<<<<<<< @@ -2870,7 +2871,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":22 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":22 * cdef int fid = FDConvert(fname) * if 0 <= fid < self.vector.size(): * return self.vector[0][fid] # <<<<<<<<<<<<<< @@ -2887,7 +2888,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":23 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":23 * if 0 <= fid < self.vector.size(): * return self.vector[0][fid] * raise KeyError(fname) # <<<<<<<<<<<<<< @@ -2949,7 +2950,7 @@ static int __pyx_pw_4cdec_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_se return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":25 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":25 * raise KeyError(fname) * * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<< @@ -2969,7 +2970,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":26 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":26 * * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -2978,7 +2979,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":27 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":27 * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -3004,7 +3005,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":28 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":28 * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) * if self.vector.size() <= fid: # <<<<<<<<<<<<<< @@ -3014,7 +3015,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd __pyx_t_1 = ((__pyx_v_self->vector->size() <= __pyx_v_fid) != 0); if (__pyx_t_1) { - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":29 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":29 * if fid < 0: raise KeyError(fname) * if self.vector.size() <= fid: * self.vector.resize(fid + 1) # <<<<<<<<<<<<<< @@ -3026,7 +3027,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd } __pyx_L4:; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":30 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":30 * if self.vector.size() <= fid: * self.vector.resize(fid + 1) * self.vector[0][fid] = value # <<<<<<<<<<<<<< @@ -3059,7 +3060,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_11__iter__(PyObject *__pyx_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":32 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":32 * self.vector[0][fid] = value * * def __iter__(self): # <<<<<<<<<<<<<< @@ -3127,7 +3128,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_Generator __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":34 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":34 * def __iter__(self): * cdef unsigned fid * for fid in range(1, self.vector.size()): # <<<<<<<<<<<<<< @@ -3138,7 +3139,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_Generator for (__pyx_t_2 = 1; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_fid = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":35 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":35 * cdef unsigned fid * for fid in range(1, self.vector.size()): * yield str(FDConvert(fid).c_str()), self.vector[0][fid] # <<<<<<<<<<<<<< @@ -3214,7 +3215,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":37 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":37 * yield str(FDConvert(fid).c_str()), self.vector[0][fid] * * def dot(self, SparseVector other): # <<<<<<<<<<<<<< @@ -3233,7 +3234,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_13dot(struct __pyx_obj_4cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dot", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":39 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":39 * def dot(self, SparseVector other): * """vector.dot(SparseVector other) -> Dot product of the two vectors.""" * return other.dot(self) # <<<<<<<<<<<<<< @@ -3282,7 +3283,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_16tosparse(PyObject *__pyx_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":41 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":41 * return other.dot(self) * * def tosparse(self): # <<<<<<<<<<<<<< @@ -3300,7 +3301,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("tosparse", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":43 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":43 * def tosparse(self): * """vector.tosparse() -> Equivalent SparseVector.""" * cdef SparseVector sparse = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -3313,7 +3314,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj __pyx_v_sparse = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":44 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":44 * """vector.tosparse() -> Equivalent SparseVector.""" * cdef SparseVector sparse = SparseVector.__new__(SparseVector) * sparse.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<< @@ -3322,7 +3323,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj */ __pyx_v_sparse->vector = new FastSparseVector<weight_t>(); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":45 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":45 * cdef SparseVector sparse = SparseVector.__new__(SparseVector) * sparse.vector = new FastSparseVector[weight_t]() * InitSparseVector(self.vector[0], sparse.vector) # <<<<<<<<<<<<<< @@ -3331,7 +3332,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj */ Weights::InitSparseVector((__pyx_v_self->vector[0]), __pyx_v_sparse->vector); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":46 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":46 * sparse.vector = new FastSparseVector[weight_t]() * InitSparseVector(self.vector[0], sparse.vector) * return sparse # <<<<<<<<<<<<<< @@ -3374,7 +3375,7 @@ static int __pyx_pw_4cdec_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":51 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":51 * cdef FastSparseVector[weight_t]* vector * * def __init__(self): # <<<<<<<<<<<<<< @@ -3387,7 +3388,7 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector___init__(struct __pyx_obj_4cdec_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":53 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":53 * def __init__(self): * """SparseVector() -> Sparse feature/weight vector.""" * self.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<< @@ -3410,7 +3411,7 @@ static void __pyx_pw_4cdec_5_cdec_12SparseVector_3__dealloc__(PyObject *__pyx_v_ __Pyx_RefNannyFinishContext(); } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":55 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":55 * self.vector = new FastSparseVector[weight_t]() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3422,7 +3423,7 @@ static void __pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED stru __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":56 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":56 * * def __dealloc__(self): * del self.vector # <<<<<<<<<<<<<< @@ -3446,7 +3447,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_5copy(PyObject *__pyx_v_se return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":58 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":58 * del self.vector * * def copy(self): # <<<<<<<<<<<<<< @@ -3463,7 +3464,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_4copy(struct __pyx_obj_4cd int __pyx_clineno = 0; __Pyx_RefNannySetupContext("copy", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":60 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":60 * def copy(self): * """vector.copy() -> SparseVector copy.""" * return self * 1 # <<<<<<<<<<<<<< @@ -3513,7 +3514,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_7__getitem__(PyObject *__p return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":62 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":62 * return self * 1 * * def __getitem__(self, char* fname): # <<<<<<<<<<<<<< @@ -3533,7 +3534,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":63 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":63 * * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -3542,7 +3543,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_ */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":64 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":64 * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -3568,7 +3569,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_ } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":65 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":65 * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) * return self.vector.value(fid) # <<<<<<<<<<<<<< @@ -3623,7 +3624,7 @@ static int __pyx_pw_4cdec_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_s return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":67 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":67 * return self.vector.value(fid) * * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<< @@ -3643,7 +3644,7 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4c int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":68 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":68 * * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -3652,7 +3653,7 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4c */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":69 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":69 * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -3678,7 +3679,7 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4c } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":70 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":70 * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) * self.vector.set_value(fid, value) # <<<<<<<<<<<<<< @@ -3711,7 +3712,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_11__iter__(PyObject *__pyx return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":72 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":72 * self.vector.set_value(fid, value) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -3779,7 +3780,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":73 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":73 * * def __iter__(self): * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False) # <<<<<<<<<<<<<< @@ -3788,7 +3789,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat */ __pyx_cur_scope->__pyx_v_it = new FastSparseVector<weight_t>::const_iterator((__pyx_cur_scope->__pyx_v_self->vector[0]), 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":75 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":75 * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False) * cdef unsigned i * try: # <<<<<<<<<<<<<< @@ -3797,7 +3798,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat */ /*try:*/ { - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":76 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":76 * cdef unsigned i * try: * for i in range(self.vector.size()): # <<<<<<<<<<<<<< @@ -3808,7 +3809,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":77 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":77 * try: * for i in range(self.vector.size()): * yield (str(FDConvert(it[0].ptr().first).c_str()), it[0].ptr().second) # <<<<<<<<<<<<<< @@ -3849,7 +3850,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;} - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":78 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":78 * for i in range(self.vector.size()): * yield (str(FDConvert(it[0].ptr().first).c_str()), it[0].ptr().second) * pinc(it[0]) # ++it # <<<<<<<<<<<<<< @@ -3860,7 +3861,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat } } - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":80 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":80 * pinc(it[0]) # ++it * finally: * del it # <<<<<<<<<<<<<< @@ -3922,7 +3923,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_se return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":82 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":82 * del it * * def dot(self, other): # <<<<<<<<<<<<<< @@ -3942,7 +3943,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dot", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":84 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":84 * def dot(self, other): * """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors.""" * if isinstance(other, DenseVector): # <<<<<<<<<<<<<< @@ -3953,7 +3954,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":85 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":85 * """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors.""" * if isinstance(other, DenseVector): * return self.vector.dot((<DenseVector> other).vector[0]) # <<<<<<<<<<<<<< @@ -3969,7 +3970,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd goto __pyx_L3; } - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":86 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":86 * if isinstance(other, DenseVector): * return self.vector.dot((<DenseVector> other).vector[0]) * elif isinstance(other, SparseVector): # <<<<<<<<<<<<<< @@ -3980,7 +3981,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":87 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":87 * return self.vector.dot((<DenseVector> other).vector[0]) * elif isinstance(other, SparseVector): * return self.vector.dot((<SparseVector> other).vector[0]) # <<<<<<<<<<<<<< @@ -3997,7 +3998,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":88 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":88 * elif isinstance(other, SparseVector): * return self.vector.dot((<SparseVector> other).vector[0]) * raise TypeError('cannot take the dot product of %s and SparseVector' % type(other)) # <<<<<<<<<<<<<< @@ -4051,7 +4052,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_16__richcmp__(PyObject *__ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":90 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":90 * raise TypeError('cannot take the dot product of %s and SparseVector' % type(other)) * * def __richcmp__(SparseVector x, SparseVector y, int op): # <<<<<<<<<<<<<< @@ -4069,7 +4070,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":93 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":93 * if op == 2: # == * return x.vector[0] == y.vector[0] * elif op == 3: # != # <<<<<<<<<<<<<< @@ -4078,7 +4079,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx */ switch (__pyx_v_op) { - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":91 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":91 * * def __richcmp__(SparseVector x, SparseVector y, int op): * if op == 2: # == # <<<<<<<<<<<<<< @@ -4087,7 +4088,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx */ case 2: - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":92 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":92 * def __richcmp__(SparseVector x, SparseVector y, int op): * if op == 2: # == * return x.vector[0] == y.vector[0] # <<<<<<<<<<<<<< @@ -4102,7 +4103,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx goto __pyx_L0; break; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":93 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":93 * if op == 2: # == * return x.vector[0] == y.vector[0] * elif op == 3: # != # <<<<<<<<<<<<<< @@ -4111,7 +4112,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx */ case 3: - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":94 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":94 * return x.vector[0] == y.vector[0] * elif op == 3: # != * return not (x == y) # <<<<<<<<<<<<<< @@ -4130,7 +4131,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx break; } - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":95 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":95 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<< @@ -4166,7 +4167,7 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__(PyObject *__pyx return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":97 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":97 * raise NotImplemented('comparison not implemented for SparseVector') * * def __len__(self): # <<<<<<<<<<<<<< @@ -4179,7 +4180,7 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_12SparseVector_17__len__(struct __pyx_ob __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":98 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":98 * * def __len__(self): * return self.vector.size() # <<<<<<<<<<<<<< @@ -4219,7 +4220,7 @@ static int __pyx_pw_4cdec_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":100 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":100 * return self.vector.size() * * def __contains__(self, char* fname): # <<<<<<<<<<<<<< @@ -4232,7 +4233,7 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_19__contains__(struct __pyx_obj_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__contains__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":101 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":101 * * def __contains__(self, char* fname): * return self.vector.nonzero(FDConvert(fname)) # <<<<<<<<<<<<<< @@ -4259,7 +4260,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_22__neg__(PyObject *__pyx_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":103 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":103 * return self.vector.nonzero(FDConvert(fname)) * * def __neg__(self): # <<<<<<<<<<<<<< @@ -4277,7 +4278,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__neg__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":104 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":104 * * def __neg__(self): * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -4290,7 +4291,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj __pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":105 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":105 * def __neg__(self): * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](self.vector[0]) # <<<<<<<<<<<<<< @@ -4299,7 +4300,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj */ __pyx_v_result->vector = new FastSparseVector<weight_t>((__pyx_v_self->vector[0])); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":106 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":106 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](self.vector[0]) * result.vector[0] *= -1.0 # <<<<<<<<<<<<<< @@ -4308,7 +4309,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj */ (__pyx_v_result->vector[0]) *= -1.0; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":107 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":107 * result.vector = new FastSparseVector[weight_t](self.vector[0]) * result.vector[0] *= -1.0 * return result # <<<<<<<<<<<<<< @@ -4352,7 +4353,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":109 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":109 * return result * * def __iadd__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<< @@ -4365,7 +4366,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_23__iadd__(struct __pyx_ob __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iadd__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":110 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":110 * * def __iadd__(SparseVector self, SparseVector other): * self.vector[0] += other.vector[0] # <<<<<<<<<<<<<< @@ -4374,7 +4375,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_23__iadd__(struct __pyx_ob */ (__pyx_v_self->vector[0]) += (__pyx_v_other->vector[0]); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":111 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":111 * def __iadd__(SparseVector self, SparseVector other): * self.vector[0] += other.vector[0] * return self # <<<<<<<<<<<<<< @@ -4412,7 +4413,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_26__isub__(PyObject *__pyx return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":113 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":113 * return self * * def __isub__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<< @@ -4425,7 +4426,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_25__isub__(struct __pyx_ob __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__isub__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":114 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":114 * * def __isub__(SparseVector self, SparseVector other): * self.vector[0] -= other.vector[0] # <<<<<<<<<<<<<< @@ -4434,7 +4435,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_25__isub__(struct __pyx_ob */ (__pyx_v_self->vector[0]) -= (__pyx_v_other->vector[0]); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":115 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":115 * def __isub__(SparseVector self, SparseVector other): * self.vector[0] -= other.vector[0] * return self # <<<<<<<<<<<<<< @@ -4477,7 +4478,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_28__imul__(PyObject *__pyx return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":117 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":117 * return self * * def __imul__(SparseVector self, float scalar): # <<<<<<<<<<<<<< @@ -4490,7 +4491,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_27__imul__(struct __pyx_ob __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__imul__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":118 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":118 * * def __imul__(SparseVector self, float scalar): * self.vector[0] *= scalar # <<<<<<<<<<<<<< @@ -4499,7 +4500,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_27__imul__(struct __pyx_ob */ (__pyx_v_self->vector[0]) *= __pyx_v_scalar; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":119 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":119 * def __imul__(SparseVector self, float scalar): * self.vector[0] *= scalar * return self # <<<<<<<<<<<<<< @@ -4544,7 +4545,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx } #endif /*!(#if PY_MAJOR_VERSION < 3)*/ -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":121 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":121 * return self * * def __idiv__(SparseVector self, float scalar): # <<<<<<<<<<<<<< @@ -4558,7 +4559,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(struct __pyx_ob __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__idiv__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":122 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":122 * * def __idiv__(SparseVector self, float scalar): * self.vector[0] /= scalar # <<<<<<<<<<<<<< @@ -4567,7 +4568,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(struct __pyx_ob */ (__pyx_v_self->vector[0]) /= __pyx_v_scalar; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":123 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":123 * def __idiv__(SparseVector self, float scalar): * self.vector[0] /= scalar * return self # <<<<<<<<<<<<<< @@ -4607,7 +4608,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_32__add__(PyObject *__pyx_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":125 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":125 * return self * * def __add__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<< @@ -4625,7 +4626,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_31__add__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__add__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":126 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":126 * * def __add__(SparseVector x, SparseVector y): * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -4638,7 +4639,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_31__add__(struct __pyx_obj __pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":127 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":127 * def __add__(SparseVector x, SparseVector y): * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) # <<<<<<<<<<<<<< @@ -4647,7 +4648,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_31__add__(struct __pyx_obj */ __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) + (__pyx_v_y->vector[0]))); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":128 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":128 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) * return result # <<<<<<<<<<<<<< @@ -4692,7 +4693,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":130 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":130 * return result * * def __sub__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<< @@ -4710,7 +4711,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_33__sub__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__sub__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":131 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":131 * * def __sub__(SparseVector x, SparseVector y): * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -4723,7 +4724,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_33__sub__(struct __pyx_obj __pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":132 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":132 * def __sub__(SparseVector x, SparseVector y): * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) # <<<<<<<<<<<<<< @@ -4732,7 +4733,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_33__sub__(struct __pyx_obj */ __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) - (__pyx_v_y->vector[0]))); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":133 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":133 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) * return result # <<<<<<<<<<<<<< @@ -4768,7 +4769,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_36__mul__(PyObject *__pyx_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":135 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":135 * return result * * def __mul__(x, y): # <<<<<<<<<<<<<< @@ -4791,7 +4792,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__mul__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":138 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":138 * cdef SparseVector vector * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<< @@ -4812,7 +4813,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_ } /*else*/ { - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":139 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":139 * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y * else: vector, scalar = y, x # <<<<<<<<<<<<<< @@ -4829,7 +4830,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_ } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":140 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":140 * if isinstance(x, SparseVector): vector, scalar = x, y * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -4842,7 +4843,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_ __pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":141 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":141 * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) # <<<<<<<<<<<<<< @@ -4851,7 +4852,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_ */ __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) * __pyx_v_scalar)); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":142 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":142 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) * return result # <<<<<<<<<<<<<< @@ -4890,7 +4891,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_38__div__(PyObject *__pyx_ } #endif /*!(#if PY_MAJOR_VERSION < 3)*/ -/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":144 +/* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":144 * return result * * def __div__(x, y): # <<<<<<<<<<<<<< @@ -4914,7 +4915,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__div__", 0); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":147 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":147 * cdef SparseVector vector * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<< @@ -4935,7 +4936,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_ } /*else*/ { - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":148 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":148 * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y * else: vector, scalar = y, x # <<<<<<<<<<<<<< @@ -4952,7 +4953,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_ } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":149 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":149 * if isinstance(x, SparseVector): vector, scalar = x, y * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -4965,7 +4966,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_ __pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":150 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":150 * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) # <<<<<<<<<<<<<< @@ -4973,7 +4974,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_ */ __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) / __pyx_v_scalar)); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":151 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":151 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) * return result # <<<<<<<<<<<<<< @@ -5011,7 +5012,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_1_phrase(PyObject *__pyx_self, PyObject * } static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":6 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":6 * * def _phrase(phrase): * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<< @@ -5177,7 +5178,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator18(__pyx_GeneratorObje return NULL; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":5 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":5 * import cdec.sa._sa as _sa * * def _phrase(phrase): # <<<<<<<<<<<<<< @@ -5206,7 +5207,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_sel __Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":6 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":6 * * def _phrase(phrase): * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<< @@ -5320,7 +5321,7 @@ static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":11 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":11 * cdef public bytes cat * cdef public unsigned ref * def __init__(self, bytes cat, unsigned ref=0): # <<<<<<<<<<<<<< @@ -5333,7 +5334,7 @@ static int __pyx_pf_4cdec_5_cdec_2NT___init__(struct __pyx_obj_4cdec_5_cdec_NT * __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":13 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":13 * def __init__(self, bytes cat, unsigned ref=0): * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`.""" * self.cat = cat # <<<<<<<<<<<<<< @@ -5346,7 +5347,7 @@ static int __pyx_pf_4cdec_5_cdec_2NT___init__(struct __pyx_obj_4cdec_5_cdec_NT * __Pyx_DECREF(((PyObject *)__pyx_v_self->cat)); __pyx_v_self->cat = __pyx_v_cat; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":14 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":14 * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`.""" * self.cat = cat * self.ref = ref # <<<<<<<<<<<<<< @@ -5371,7 +5372,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3__str__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":16 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":16 * self.ref = ref * * def __str__(self): # <<<<<<<<<<<<<< @@ -5390,7 +5391,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":17 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":17 * * def __str__(self): * if self.ref > 0: # <<<<<<<<<<<<<< @@ -5400,7 +5401,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cde __pyx_t_1 = ((__pyx_v_self->ref > 0) != 0); if (__pyx_t_1) { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":18 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":18 * def __str__(self): * if self.ref > 0: * return '[%s,%d]' % (self.cat, self.ref) # <<<<<<<<<<<<<< @@ -5428,7 +5429,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cde } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":19 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":19 * if self.ref > 0: * return '[%s,%d]' % (self.cat, self.ref) * return '[%s]' % self.cat # <<<<<<<<<<<<<< @@ -5466,7 +5467,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self) return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":9 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":9 * * cdef class NT: * cdef public bytes cat # <<<<<<<<<<<<<< @@ -5562,7 +5563,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self) return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":10 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":10 * cdef class NT: * cdef public bytes cat * cdef public unsigned ref # <<<<<<<<<<<<<< @@ -5683,7 +5684,7 @@ static int __pyx_pw_4cdec_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObje return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":23 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":23 * cdef class NTRef: * cdef public unsigned ref * def __init__(self, unsigned ref): # <<<<<<<<<<<<<< @@ -5696,7 +5697,7 @@ static int __pyx_pf_4cdec_5_cdec_5NTRef___init__(struct __pyx_obj_4cdec_5_cdec_N __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":25 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":25 * def __init__(self, unsigned ref): * """NTRef(int ref) -> Non-terminal reference.""" * self.ref = ref # <<<<<<<<<<<<<< @@ -5721,7 +5722,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self) { return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":27 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":27 * self.ref = ref * * def __str__(self): # <<<<<<<<<<<<<< @@ -5739,7 +5740,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_2__str__(struct __pyx_obj_4cdec_5_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":28 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":28 * * def __str__(self): * return '[%d]' % self.ref # <<<<<<<<<<<<<< @@ -5780,7 +5781,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_se return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":22 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":22 * * cdef class NTRef: * cdef public unsigned ref # <<<<<<<<<<<<<< @@ -5847,7 +5848,7 @@ static int __pyx_pf_4cdec_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_4cdec_5_c return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":30 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":30 * return '[%d]' % self.ref * * cdef TRule convert_rule(_sa.Rule rule): # <<<<<<<<<<<<<< @@ -5878,7 +5879,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convert_rule", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":31 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":31 * * cdef TRule convert_rule(_sa.Rule rule): * lhs = _sa.sym_tocat(rule.lhs) # <<<<<<<<<<<<<< @@ -5887,7 +5888,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st */ __pyx_v_lhs = __pyx_f_4cdec_2sa_3_sa_sym_tocat(__pyx_v_rule->lhs); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":32 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":32 * cdef TRule convert_rule(_sa.Rule rule): * lhs = _sa.sym_tocat(rule.lhs) * scores = dict(rule.scores) # <<<<<<<<<<<<<< @@ -5905,7 +5906,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st __pyx_v_scores = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":33 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":33 * lhs = _sa.sym_tocat(rule.lhs) * scores = dict(rule.scores) * f, e = [], [] # <<<<<<<<<<<<<< @@ -5921,7 +5922,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st __pyx_v_e = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":34 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":34 * scores = dict(rule.scores) * f, e = [], [] * cdef int* fsyms = rule.f.syms # <<<<<<<<<<<<<< @@ -5931,7 +5932,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st __pyx_t_3 = __pyx_v_rule->f->syms; __pyx_v_fsyms = __pyx_t_3; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":35 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":35 * f, e = [], [] * cdef int* fsyms = rule.f.syms * for i in range(rule.f.n): # <<<<<<<<<<<<<< @@ -5942,7 +5943,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":36 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":36 * cdef int* fsyms = rule.f.syms * for i in range(rule.f.n): * if _sa.sym_isvar(fsyms[i]): # <<<<<<<<<<<<<< @@ -5952,7 +5953,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st __pyx_t_6 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_fsyms[__pyx_v_i])) != 0); if (__pyx_t_6) { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":37 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":37 * for i in range(rule.f.n): * if _sa.sym_isvar(fsyms[i]): * f.append(NT(_sa.sym_tocat(fsyms[i]))) # <<<<<<<<<<<<<< @@ -5975,7 +5976,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st } /*else*/ { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":39 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":39 * f.append(NT(_sa.sym_tocat(fsyms[i]))) * else: * f.append(_sa.sym_tostring(fsyms[i])) # <<<<<<<<<<<<<< @@ -5990,7 +5991,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st __pyx_L5:; } - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":40 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":40 * else: * f.append(_sa.sym_tostring(fsyms[i])) * cdef int* esyms = rule.e.syms # <<<<<<<<<<<<<< @@ -6000,7 +6001,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st __pyx_t_3 = __pyx_v_rule->e->syms; __pyx_v_esyms = __pyx_t_3; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":41 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":41 * f.append(_sa.sym_tostring(fsyms[i])) * cdef int* esyms = rule.e.syms * for i in range(rule.e.n): # <<<<<<<<<<<<<< @@ -6011,7 +6012,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":42 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":42 * cdef int* esyms = rule.e.syms * for i in range(rule.e.n): * if _sa.sym_isvar(esyms[i]): # <<<<<<<<<<<<<< @@ -6021,7 +6022,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st __pyx_t_6 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_esyms[__pyx_v_i])) != 0); if (__pyx_t_6) { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":43 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":43 * for i in range(rule.e.n): * if _sa.sym_isvar(esyms[i]): * e.append(NTRef(_sa.sym_getindex(esyms[i]))) # <<<<<<<<<<<<<< @@ -6044,7 +6045,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st } /*else*/ { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":45 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":45 * e.append(NTRef(_sa.sym_getindex(esyms[i]))) * else: * e.append(_sa.sym_tostring(esyms[i])) # <<<<<<<<<<<<<< @@ -6059,7 +6060,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st __pyx_L8:; } - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":46 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":46 * else: * e.append(_sa.sym_tostring(esyms[i])) * a = list(rule.alignments()) # <<<<<<<<<<<<<< @@ -6082,7 +6083,7 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st __pyx_v_a = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":47 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":47 * e.append(_sa.sym_tostring(esyms[i])) * a = list(rule.alignments()) * return TRule(lhs, f, e, scores, a) # <<<<<<<<<<<<<< @@ -6155,7 +6156,7 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObje static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__scores,&__pyx_n_s__a,0}; PyObject* values[5] = {0,0,0,0,0}; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":52 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":52 * cdef shared_ptr[grammar.TRule]* rule * * def __init__(self, lhs, f, e, scores, a=None): # <<<<<<<<<<<<<< @@ -6244,7 +6245,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":59 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":59 * scores: dictionary of feature scores * a: optional list of alignment points""" * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) # <<<<<<<<<<<<<< @@ -6259,7 +6260,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T } __pyx_v_self->rule = new boost::shared_ptr<TRule>(__pyx_t_1); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":60 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":60 * a: optional list of alignment points""" * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) * self.lhs = lhs # <<<<<<<<<<<<<< @@ -6268,7 +6269,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T */ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__lhs, __pyx_v_lhs) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":61 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":61 * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) * self.lhs = lhs * self.e = e # <<<<<<<<<<<<<< @@ -6277,7 +6278,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T */ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__e, __pyx_v_e) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":62 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":62 * self.lhs = lhs * self.e = e * self.f = f # <<<<<<<<<<<<<< @@ -6286,7 +6287,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T */ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__f, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":63 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":63 * self.e = e * self.f = f * self.scores = scores # <<<<<<<<<<<<<< @@ -6295,7 +6296,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T */ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scores, __pyx_v_scores) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":64 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":64 * self.f = f * self.scores = scores * if a: # <<<<<<<<<<<<<< @@ -6305,7 +6306,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":65 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":65 * self.scores = scores * if a: * self.a = a # <<<<<<<<<<<<<< @@ -6317,7 +6318,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":66 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":66 * if a: * self.a = a * self.rule.get().ComputeArity() # <<<<<<<<<<<<<< @@ -6345,7 +6346,7 @@ static void __pyx_pw_4cdec_5_cdec_5TRule_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":68 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":68 * self.rule.get().ComputeArity() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -6357,7 +6358,7 @@ static void __pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":69 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":69 * * def __dealloc__(self): * del self.rule # <<<<<<<<<<<<<< @@ -6380,7 +6381,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":72 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":72 * * property arity: * def __get__(self): # <<<<<<<<<<<<<< @@ -6397,7 +6398,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(struct __pyx_obj_4c int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":73 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":73 * property arity: * def __get__(self): * return self.rule.get().arity_ # <<<<<<<<<<<<<< @@ -6434,7 +6435,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":76 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":76 * * property f: * def __get__(self): # <<<<<<<<<<<<<< @@ -6461,7 +6462,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":77 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":77 * property f: * def __get__(self): * cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<< @@ -6470,7 +6471,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_ */ __pyx_v_f_ = (&__pyx_v_self->rule->get()->f_); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":79 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":79 * cdef vector[WordID]* f_ = &self.rule.get().f_ * cdef WordID w * cdef f = [] # <<<<<<<<<<<<<< @@ -6482,7 +6483,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_ __pyx_v_f = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":81 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":81 * cdef f = [] * cdef unsigned i * cdef int idx = 0 # <<<<<<<<<<<<<< @@ -6491,7 +6492,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_ */ __pyx_v_idx = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":82 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":82 * cdef unsigned i * cdef int idx = 0 * for i in range(f_.size()): # <<<<<<<<<<<<<< @@ -6502,7 +6503,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":83 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":83 * cdef int idx = 0 * for i in range(f_.size()): * w = f_[0][i] # <<<<<<<<<<<<<< @@ -6511,7 +6512,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_ */ __pyx_v_w = ((__pyx_v_f_[0])[__pyx_v_i]); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":84 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":84 * for i in range(f_.size()): * w = f_[0][i] * if w < 0: # <<<<<<<<<<<<<< @@ -6521,7 +6522,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_ __pyx_t_4 = ((__pyx_v_w < 0) != 0); if (__pyx_t_4) { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":85 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":85 * w = f_[0][i] * if w < 0: * idx += 1 # <<<<<<<<<<<<<< @@ -6530,7 +6531,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_ */ __pyx_v_idx = (__pyx_v_idx + 1); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":86 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":86 * if w < 0: * idx += 1 * f.append(NT(TDConvert(-w).c_str(), idx)) # <<<<<<<<<<<<<< @@ -6560,7 +6561,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_ } /*else*/ { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":88 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":88 * f.append(NT(TDConvert(-w).c_str(), idx)) * else: * f.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<< @@ -6589,7 +6590,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_ __pyx_L5:; } - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":89 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":89 * else: * f.append(unicode(TDConvert(w).c_str(), encoding='utf8')) * return f # <<<<<<<<<<<<<< @@ -6627,7 +6628,7 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyOb return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":91 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":91 * return f * * def __set__(self, f): # <<<<<<<<<<<<<< @@ -6654,7 +6655,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":92 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":92 * * def __set__(self, f): * cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<< @@ -6663,7 +6664,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde */ __pyx_v_f_ = (&__pyx_v_self->rule->get()->f_); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":93 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":93 * def __set__(self, f): * cdef vector[WordID]* f_ = &self.rule.get().f_ * f_.resize(len(f)) # <<<<<<<<<<<<<< @@ -6673,7 +6674,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde __pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f_->resize(__pyx_t_1); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":95 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":95 * f_.resize(len(f)) * cdef unsigned i * cdef int idx = 0 # <<<<<<<<<<<<<< @@ -6682,7 +6683,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde */ __pyx_v_idx = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":96 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":96 * cdef unsigned i * cdef int idx = 0 * for i in range(len(f)): # <<<<<<<<<<<<<< @@ -6693,7 +6694,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":97 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":97 * cdef int idx = 0 * for i in range(len(f)): * if isinstance(f[i], NT): # <<<<<<<<<<<<<< @@ -6707,7 +6708,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":98 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":98 * for i in range(len(f)): * if isinstance(f[i], NT): * f_[0][i] = -TDConvert((<NT> f[i]).cat) # <<<<<<<<<<<<<< @@ -6723,7 +6724,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde } /*else*/ { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":100 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":100 * f_[0][i] = -TDConvert((<NT> f[i]).cat) * else: * fi = as_str(f[i]) # <<<<<<<<<<<<<< @@ -6739,7 +6740,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde __pyx_v_fi = ((PyObject*)__pyx_t_7); __pyx_t_7 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":101 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":101 * else: * fi = as_str(f[i]) * f_[0][i] = TDConvert(fi) # <<<<<<<<<<<<<< @@ -6776,7 +6777,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":104 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":104 * * property e: * def __get__(self): # <<<<<<<<<<<<<< @@ -6803,7 +6804,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":105 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":105 * property e: * def __get__(self): * cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<< @@ -6812,7 +6813,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_ */ __pyx_v_e_ = (&__pyx_v_self->rule->get()->e_); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":107 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":107 * cdef vector[WordID]* e_ = &self.rule.get().e_ * cdef WordID w * cdef e = [] # <<<<<<<<<<<<<< @@ -6824,7 +6825,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_ __pyx_v_e = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":109 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":109 * cdef e = [] * cdef unsigned i * cdef int idx = 0 # <<<<<<<<<<<<<< @@ -6833,7 +6834,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_ */ __pyx_v_idx = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":110 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":110 * cdef unsigned i * cdef int idx = 0 * for i in range(e_.size()): # <<<<<<<<<<<<<< @@ -6844,7 +6845,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":111 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":111 * cdef int idx = 0 * for i in range(e_.size()): * w = e_[0][i] # <<<<<<<<<<<<<< @@ -6853,7 +6854,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_ */ __pyx_v_w = ((__pyx_v_e_[0])[__pyx_v_i]); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":112 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":112 * for i in range(e_.size()): * w = e_[0][i] * if w < 1: # <<<<<<<<<<<<<< @@ -6863,7 +6864,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_ __pyx_t_4 = ((__pyx_v_w < 1) != 0); if (__pyx_t_4) { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":113 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":113 * w = e_[0][i] * if w < 1: * idx += 1 # <<<<<<<<<<<<<< @@ -6872,7 +6873,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_ */ __pyx_v_idx = (__pyx_v_idx + 1); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":114 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":114 * if w < 1: * idx += 1 * e.append(NTRef(1-w)) # <<<<<<<<<<<<<< @@ -6897,7 +6898,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_ } /*else*/ { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":116 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":116 * e.append(NTRef(1-w)) * else: * e.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<< @@ -6926,7 +6927,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_ __pyx_L5:; } - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":117 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":117 * else: * e.append(unicode(TDConvert(w).c_str(), encoding='utf8')) * return e # <<<<<<<<<<<<<< @@ -6964,7 +6965,7 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyOb return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":119 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":119 * return e * * def __set__(self, e): # <<<<<<<<<<<<<< @@ -6991,7 +6992,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":120 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":120 * * def __set__(self, e): * cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<< @@ -7000,7 +7001,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cde */ __pyx_v_e_ = (&__pyx_v_self->rule->get()->e_); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":121 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":121 * def __set__(self, e): * cdef vector[WordID]* e_ = &self.rule.get().e_ * e_.resize(len(e)) # <<<<<<<<<<<<<< @@ -7010,7 +7011,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cde __pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_e_->resize(__pyx_t_1); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":123 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":123 * e_.resize(len(e)) * cdef unsigned i * for i in range(len(e)): # <<<<<<<<<<<<<< @@ -7021,7 +7022,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cde for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":124 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":124 * cdef unsigned i * for i in range(len(e)): * if isinstance(e[i], NTRef): # <<<<<<<<<<<<<< @@ -7035,7 +7036,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cde __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":125 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":125 * for i in range(len(e)): * if isinstance(e[i], NTRef): * e_[0][i] = 1-e[i].ref # <<<<<<<<<<<<<< @@ -7057,7 +7058,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cde } /*else*/ { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":127 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":127 * e_[0][i] = 1-e[i].ref * else: * ei = as_str(e[i]) # <<<<<<<<<<<<<< @@ -7073,7 +7074,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cde __pyx_v_ei = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":128 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":128 * else: * ei = as_str(e[i]) * e_[0][i] = TDConvert(ei) # <<<<<<<<<<<<<< @@ -7111,7 +7112,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":131 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":131 * * property a: * def __get__(self): # <<<<<<<<<<<<<< @@ -7179,7 +7180,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObje __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":133 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":133 * def __get__(self): * cdef unsigned i * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ # <<<<<<<<<<<<<< @@ -7188,7 +7189,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObje */ __pyx_cur_scope->__pyx_v_a = (&__pyx_cur_scope->__pyx_v_self->rule->get()->a_); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":134 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":134 * cdef unsigned i * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ * for i in range(a.size()): # <<<<<<<<<<<<<< @@ -7199,7 +7200,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObje for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":135 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":135 * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ * for i in range(a.size()): * yield (a[0][i].s_, a[0][i].t_) # <<<<<<<<<<<<<< @@ -7258,7 +7259,7 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyOb return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":137 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":137 * yield (a[0][i].s_, a[0][i].t_) * * def __set__(self, a): # <<<<<<<<<<<<<< @@ -7287,7 +7288,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":138 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":138 * * def __set__(self, a): * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_ # <<<<<<<<<<<<<< @@ -7296,7 +7297,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde */ __pyx_v_a_ = (&__pyx_v_self->rule->get()->a_); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":139 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":139 * def __set__(self, a): * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_ * a_.resize(len(a)) # <<<<<<<<<<<<<< @@ -7306,7 +7307,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde __pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_a_->resize(__pyx_t_1); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":142 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":142 * cdef unsigned i * cdef int s, t * for i in range(len(a)): # <<<<<<<<<<<<<< @@ -7317,7 +7318,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":143 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":143 * cdef int s, t * for i in range(len(a)): * s, t = a[i] # <<<<<<<<<<<<<< @@ -7384,7 +7385,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde __pyx_v_s = __pyx_t_8; __pyx_v_t = __pyx_t_9; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":144 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":144 * for i in range(len(a)): * s, t = a[i] * a_[0][i] = grammar.AlignmentPoint(s, t) # <<<<<<<<<<<<<< @@ -7419,7 +7420,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":147 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":147 * * property scores: * def __get__(self): # <<<<<<<<<<<<<< @@ -7437,7 +7438,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":148 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":148 * property scores: * def __get__(self): * cdef SparseVector scores = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -7450,7 +7451,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(struct __pyx_obj_4 __pyx_v_scores = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":149 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":149 * def __get__(self): * cdef SparseVector scores = SparseVector.__new__(SparseVector) * scores.vector = new FastSparseVector[double](self.rule.get().scores_) # <<<<<<<<<<<<<< @@ -7459,7 +7460,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(struct __pyx_obj_4 */ __pyx_v_scores->vector = new FastSparseVector<double>(__pyx_v_self->rule->get()->scores_); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":150 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":150 * cdef SparseVector scores = SparseVector.__new__(SparseVector) * scores.vector = new FastSparseVector[double](self.rule.get().scores_) * return scores # <<<<<<<<<<<<<< @@ -7495,7 +7496,7 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":152 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":152 * return scores * * def __set__(self, scores): # <<<<<<<<<<<<<< @@ -7527,7 +7528,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":153 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":153 * * def __set__(self, scores): * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_ # <<<<<<<<<<<<<< @@ -7536,7 +7537,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_ */ __pyx_v_scores_ = (&__pyx_v_self->rule->get()->scores_); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":154 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":154 * def __set__(self, scores): * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_ * scores_.clear() # <<<<<<<<<<<<<< @@ -7545,7 +7546,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_ */ __pyx_v_scores_->clear(); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":157 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":157 * cdef int fid * cdef float fval * for fname, fval in scores.items(): # <<<<<<<<<<<<<< @@ -7650,7 +7651,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_ __pyx_t_5 = 0; __pyx_v_fval = __pyx_t_9; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":158 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":158 * cdef float fval * for fname, fval in scores.items(): * fn = as_str(fname) # <<<<<<<<<<<<<< @@ -7663,7 +7664,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_ __pyx_v_fn = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":159 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":159 * for fname, fval in scores.items(): * fn = as_str(fname) * fid = FDConvert(fn) # <<<<<<<<<<<<<< @@ -7673,7 +7674,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_ __pyx_t_10 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_fid = FD::Convert(__pyx_t_10); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":160 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":160 * fn = as_str(fname) * fid = FDConvert(fn) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -7697,7 +7698,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_ } __pyx_L7:; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":161 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":161 * fid = FDConvert(fn) * if fid < 0: raise KeyError(fname) * scores_.set_value(fid, fval) # <<<<<<<<<<<<<< @@ -7736,7 +7737,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_se return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":164 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":164 * * property lhs: * def __get__(self): # <<<<<<<<<<<<<< @@ -7754,7 +7755,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_4cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":165 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":165 * property lhs: * def __get__(self): * return NT(TDConvert(-self.rule.get().lhs_).c_str()) # <<<<<<<<<<<<<< @@ -7800,7 +7801,7 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, Py return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":167 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":167 * return NT(TDConvert(-self.rule.get().lhs_).c_str()) * * def __set__(self, lhs): # <<<<<<<<<<<<<< @@ -7822,7 +7823,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_4cdec_5_c __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_lhs); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":168 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":168 * * def __set__(self, lhs): * if not isinstance(lhs, NT): # <<<<<<<<<<<<<< @@ -7833,7 +7834,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_4cdec_5_c __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":169 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":169 * def __set__(self, lhs): * if not isinstance(lhs, NT): * lhs = NT(lhs) # <<<<<<<<<<<<<< @@ -7855,7 +7856,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_4cdec_5_c } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":170 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":170 * if not isinstance(lhs, NT): * lhs = NT(lhs) * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat) # <<<<<<<<<<<<<< @@ -7890,7 +7891,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5__str__(PyObject *__pyx_v_self) { } static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":173 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":173 * * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<< @@ -8035,7 +8036,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator19(__pyx_Genera return NULL; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":172 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":172 * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat) * * def __str__(self): # <<<<<<<<<<<<<< @@ -8067,7 +8068,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_4__str__(struct __pyx_obj_4cdec_5_ __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":173 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":173 * * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<< @@ -8090,7 +8091,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_4__str__(struct __pyx_obj_4cdec_5_ __pyx_v_scores = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":174 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":174 * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) * return '%s ||| %s ||| %s ||| %s' % (self.lhs, # <<<<<<<<<<<<<< @@ -8101,7 +8102,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_4__str__(struct __pyx_obj_4cdec_5_ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":175 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":175 * scores = ' '.join('%s=%s' % feat for feat in self.scores) * return '%s ||| %s ||| %s ||| %s' % (self.lhs, * _phrase(self.f), _phrase(self.e), scores) # <<<<<<<<<<<<<< @@ -8245,7 +8246,7 @@ static int __pyx_pw_4cdec_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObje return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":178 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":178 * * cdef class MRule(TRule): * def __init__(self, lhs, rhs, scores): # <<<<<<<<<<<<<< @@ -8272,7 +8273,7 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":183 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":183 * rhs: right hand side phrase (list of words/NT) * scores: dictionary of feature scores""" * cdef unsigned i = 1 # <<<<<<<<<<<<<< @@ -8281,7 +8282,7 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M */ __pyx_v_i = 1; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":184 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":184 * scores: dictionary of feature scores""" * cdef unsigned i = 1 * e = [] # <<<<<<<<<<<<<< @@ -8293,7 +8294,7 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M __pyx_v_e = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":185 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":185 * cdef unsigned i = 1 * e = [] * for s in rhs: # <<<<<<<<<<<<<< @@ -8338,7 +8339,7 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M __pyx_v_s = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":186 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":186 * e = [] * for s in rhs: * if isinstance(s, NT): # <<<<<<<<<<<<<< @@ -8349,7 +8350,7 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":187 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":187 * for s in rhs: * if isinstance(s, NT): * e.append(NTRef(i)) # <<<<<<<<<<<<<< @@ -8369,7 +8370,7 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_e, __pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":188 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":188 * if isinstance(s, NT): * e.append(NTRef(i)) * i += 1 # <<<<<<<<<<<<<< @@ -8381,7 +8382,7 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M } /*else*/ { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":190 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":190 * i += 1 * else: * e.append(s) # <<<<<<<<<<<<<< @@ -8394,7 +8395,7 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":191 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":191 * else: * e.append(s) * super(MRule, self).__init__(lhs, rhs, e, scores, None) # <<<<<<<<<<<<<< @@ -8462,7 +8463,7 @@ static void __pyx_pw_4cdec_5_cdec_7Grammar_1__dealloc__(PyObject *__pyx_v_self) __Pyx_RefNannyFinishContext(); } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":196 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":196 * cdef shared_ptr[grammar.Grammar]* grammar * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -8474,7 +8475,7 @@ static void __pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":197 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":197 * * def __dealloc__(self): * del self.grammar # <<<<<<<<<<<<<< @@ -8498,7 +8499,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":199 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":199 * del self.grammar * * def __iter__(self): # <<<<<<<<<<<<<< @@ -8564,7 +8565,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":200 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":200 * * def __iter__(self): * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() # <<<<<<<<<<<<<< @@ -8573,7 +8574,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec */ __pyx_cur_scope->__pyx_v_root = __pyx_cur_scope->__pyx_v_self->grammar->get()->GetRoot(); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":201 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":201 * def __iter__(self): * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() * cdef grammar.const_RuleBin* rbin = root.GetRules() # <<<<<<<<<<<<<< @@ -8582,7 +8583,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec */ __pyx_cur_scope->__pyx_v_rbin = __pyx_cur_scope->__pyx_v_root->GetRules(); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":204 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":204 * cdef TRule trule * cdef unsigned i * for i in range(rbin.GetNumRules()): # <<<<<<<<<<<<<< @@ -8593,7 +8594,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":205 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":205 * cdef unsigned i * for i in range(rbin.GetNumRules()): * trule = TRule.__new__(TRule) # <<<<<<<<<<<<<< @@ -8609,7 +8610,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec __pyx_cur_scope->__pyx_v_trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":206 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":206 * for i in range(rbin.GetNumRules()): * trule = TRule.__new__(TRule) * trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) # <<<<<<<<<<<<<< @@ -8618,7 +8619,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec */ __pyx_cur_scope->__pyx_v_trule->rule = new boost::shared_ptr<TRule>(__pyx_cur_scope->__pyx_v_rbin->GetIthRule(__pyx_cur_scope->__pyx_v_i)); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":207 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":207 * trule = TRule.__new__(TRule) * trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) * yield trule # <<<<<<<<<<<<<< @@ -8663,7 +8664,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":210 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":210 * * property name: * def __get__(self): # <<<<<<<<<<<<<< @@ -8681,7 +8682,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":211 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":211 * property name: * def __get__(self): * str(self.grammar.get().GetGrammarName().c_str()) # <<<<<<<<<<<<<< @@ -8724,7 +8725,7 @@ static int __pyx_pw_4cdec_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":213 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":213 * str(self.grammar.get().GetGrammarName().c_str()) * * def __set__(self, name): # <<<<<<<<<<<<<< @@ -8743,7 +8744,7 @@ static int __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_4cdec_ __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_name); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":214 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":214 * * def __set__(self, name): * name = as_str(name) # <<<<<<<<<<<<<< @@ -8756,7 +8757,7 @@ static int __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_4cdec_ __pyx_v_name = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":215 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":215 * def __set__(self, name): * name = as_str(name) * self.grammar.get().SetGrammarName(name) # <<<<<<<<<<<<<< @@ -8832,7 +8833,7 @@ static int __pyx_pw_4cdec_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":218 +/* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":218 * * cdef class TextGrammar(Grammar): * def __init__(self, rules): # <<<<<<<<<<<<<< @@ -8856,7 +8857,7 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":220 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":220 * def __init__(self, rules): * """TextGrammar(rules) -> SCFG Grammar containing the rules.""" * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) # <<<<<<<<<<<<<< @@ -8865,7 +8866,7 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5 */ __pyx_v_self->__pyx_base.grammar = new boost::shared_ptr<Grammar>(new TextGrammar()); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":221 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":221 * """TextGrammar(rules) -> SCFG Grammar containing the rules.""" * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) * cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get() # <<<<<<<<<<<<<< @@ -8874,7 +8875,7 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5 */ __pyx_v__g = ((TextGrammar *)__pyx_v_self->__pyx_base.grammar->get()); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":222 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":222 * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) * cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get() * for trule in rules: # <<<<<<<<<<<<<< @@ -8919,7 +8920,7 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5 __pyx_v_trule = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":223 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":223 * cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get() * for trule in rules: * if isinstance(trule, _sa.Rule): # <<<<<<<<<<<<<< @@ -8930,7 +8931,7 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5 __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":224 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":224 * for trule in rules: * if isinstance(trule, _sa.Rule): * trule = convert_rule(trule) # <<<<<<<<<<<<<< @@ -8946,7 +8947,7 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5 goto __pyx_L5; } - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":225 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":225 * if isinstance(trule, _sa.Rule): * trule = convert_rule(trule) * elif not isinstance(trule, TRule): # <<<<<<<<<<<<<< @@ -8957,7 +8958,7 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5 __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0); if (__pyx_t_5) { - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":226 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":226 * trule = convert_rule(trule) * elif not isinstance(trule, TRule): * raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<< @@ -8972,7 +8973,7 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5 } __pyx_L5:; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":227 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":227 * elif not isinstance(trule, TRule): * raise ValueError('the grammar should contain TRule objects') * _g.AddRule((<TRule> trule).rule[0]) # <<<<<<<<<<<<<< @@ -9003,7 +9004,7 @@ static void __pyx_pw_4cdec_5_cdec_10Hypergraph_1__dealloc__(PyObject *__pyx_v_se __Pyx_RefNannyFinishContext(); } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":8 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":8 * cdef MT19937* rng * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -9016,7 +9017,7 @@ static void __pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_4cde int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":9 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":9 * * def __dealloc__(self): * del self.hg # <<<<<<<<<<<<<< @@ -9025,7 +9026,7 @@ static void __pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_4cde */ delete __pyx_v_self->hg; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":10 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":10 * def __dealloc__(self): * del self.hg * if self.rng != NULL: # <<<<<<<<<<<<<< @@ -9035,7 +9036,7 @@ static void __pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_4cde __pyx_t_1 = ((__pyx_v_self->rng != NULL) != 0); if (__pyx_t_1) { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":11 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":11 * del self.hg * if self.rng != NULL: * del self.rng # <<<<<<<<<<<<<< @@ -9050,7 +9051,7 @@ static void __pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_4cde __Pyx_RefNannyFinishContext(); } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":13 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":13 * del self.rng * * cdef MT19937* _rng(self): # <<<<<<<<<<<<<< @@ -9068,7 +9069,7 @@ static MT19937 *__pyx_f_4cdec_5_cdec_10Hypergraph__rng(struct __pyx_obj_4cdec_5_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_rng", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":14 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":14 * * cdef MT19937* _rng(self): * if self.rng == NULL: # <<<<<<<<<<<<<< @@ -9078,7 +9079,7 @@ static MT19937 *__pyx_f_4cdec_5_cdec_10Hypergraph__rng(struct __pyx_obj_4cdec_5_ __pyx_t_1 = ((__pyx_v_self->rng == NULL) != 0); if (__pyx_t_1) { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":15 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":15 * cdef MT19937* _rng(self): * if self.rng == NULL: * self.rng = new MT19937() # <<<<<<<<<<<<<< @@ -9096,7 +9097,7 @@ static MT19937 *__pyx_f_4cdec_5_cdec_10Hypergraph__rng(struct __pyx_obj_4cdec_5_ } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":16 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":16 * if self.rng == NULL: * self.rng = new MT19937() * return self.rng # <<<<<<<<<<<<<< @@ -9128,7 +9129,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_s return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":18 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":18 * return self.rng * * def viterbi(self): # <<<<<<<<<<<<<< @@ -9147,7 +9148,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4c int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":21 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":21 * """hg.viterbi() -> String for the best hypothesis in the hypergraph.""" * cdef vector[WordID] trans * hypergraph.ViterbiESentence(self.hg[0], &trans) # <<<<<<<<<<<<<< @@ -9156,7 +9157,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4c */ ViterbiESentence((__pyx_v_self->hg[0]), (&__pyx_v_trans)); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":22 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":22 * cdef vector[WordID] trans * hypergraph.ViterbiESentence(self.hg[0], &trans) * return unicode(GetString(trans).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9206,7 +9207,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__p return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":24 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":24 * return unicode(GetString(trans).c_str(), 'utf8') * * def viterbi_trees(self): # <<<<<<<<<<<<<< @@ -9226,7 +9227,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi_trees", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":29 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":29 * e_tree: Target tree for the best hypothesis in the hypergraph. * """ * f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9249,7 +9250,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_ __pyx_v_f_tree = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":30 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":30 * """ * f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8') * e_tree = unicode(hypergraph.ViterbiETree(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9272,7 +9273,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_ __pyx_v_e_tree = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":31 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":31 * 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) # <<<<<<<<<<<<<< @@ -9319,7 +9320,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_7viterbi_features(PyObject * return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":33 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":33 * return (f_tree, e_tree) * * def viterbi_features(self): # <<<<<<<<<<<<<< @@ -9337,7 +9338,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi_features", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":36 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":36 * """hg.viterbi_features() -> SparseVector with the features corresponding * to the best derivation in the hypergraph.""" * cdef SparseVector fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -9350,7 +9351,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(struct __p __pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":37 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":37 * to the best derivation in the hypergraph.""" * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) # <<<<<<<<<<<<<< @@ -9359,7 +9360,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(struct __p */ __pyx_v_fmap->vector = new FastSparseVector<weight_t>(ViterbiFeatures((__pyx_v_self->hg[0]))); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":38 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":38 * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) * return fmap # <<<<<<<<<<<<<< @@ -9395,7 +9396,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_9viterbi_forest(PyObject *__ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":40 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":40 * return fmap * * def viterbi_forest(self): # <<<<<<<<<<<<<< @@ -9413,7 +9414,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi_forest", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":41 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":41 * * def viterbi_forest(self): * cdef Hypergraph hg = Hypergraph() # <<<<<<<<<<<<<< @@ -9425,7 +9426,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx __pyx_v_hg = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":42 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":42 * def viterbi_forest(self): * cdef Hypergraph hg = Hypergraph() * hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0]) # <<<<<<<<<<<<<< @@ -9434,7 +9435,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx */ __pyx_v_hg->hg = new Hypergraph(((__pyx_v_self->hg[0]).CreateViterbiHypergraph(NULL).get()[0])); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":43 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":43 * cdef Hypergraph hg = Hypergraph() * hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0]) * return hg # <<<<<<<<<<<<<< @@ -9471,7 +9472,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_11viterbi_joshua(PyObject *_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":45 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":45 * return hg * * def viterbi_joshua(self): # <<<<<<<<<<<<<< @@ -9489,7 +9490,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_10viterbi_joshua(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi_joshua", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":47 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":47 * def viterbi_joshua(self): * """hg.viterbi_joshua() -> Joshua representation of the best derivation.""" * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9540,7 +9541,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_13kbest(PyObject *__pyx_v_se return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":49 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":49 * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') * * def kbest(self, size): # <<<<<<<<<<<<<< @@ -9611,7 +9612,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":51 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":51 * def kbest(self, size): * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph.""" * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal](self.hg[0], size) # <<<<<<<<<<<<<< @@ -9621,7 +9622,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":54 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":54 * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal].Derivation* derivation * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -9630,7 +9631,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator */ /*try:*/ { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":55 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":55 * cdef unsigned k * try: * for k in range(size): # <<<<<<<<<<<<<< @@ -9641,7 +9642,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_1; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":56 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":56 * try: * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<< @@ -9650,7 +9651,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator */ __pyx_cur_scope->__pyx_v_derivation = __pyx_cur_scope->__pyx_v_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":57 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":57 * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not derivation: break # <<<<<<<<<<<<<< @@ -9664,7 +9665,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator } __pyx_L9:; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":58 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":58 * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not derivation: break * yield unicode(GetString(derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9701,7 +9702,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator __pyx_L8_break:; } - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":60 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":60 * yield unicode(GetString(derivation._yield).c_str(), 'utf8') * finally: * del derivations # <<<<<<<<<<<<<< @@ -9762,7 +9763,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_16kbest_trees(PyObject *__py return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":62 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":62 * del derivations * * def kbest_trees(self, size): # <<<<<<<<<<<<<< @@ -9835,7 +9836,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":64 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":64 * def kbest_trees(self, size): * """hg.kbest_trees(size) -> List of k-best trees in the hypergraph.""" * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal](self.hg[0], size) # <<<<<<<<<<<<<< @@ -9845,7 +9846,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_cur_scope->__pyx_v_f_derivations = new KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":66 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":66 * 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) # <<<<<<<<<<<<<< @@ -9855,7 +9856,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_cur_scope->__pyx_v_e_derivations = new KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":69 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":69 * cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal].Derivation* e_derivation * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -9864,7 +9865,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator */ /*try:*/ { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":70 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":70 * cdef unsigned k * try: * for k in range(size): # <<<<<<<<<<<<<< @@ -9875,7 +9876,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_1; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":71 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":71 * try: * for k in range(size): * f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<< @@ -9884,7 +9885,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator */ __pyx_cur_scope->__pyx_v_f_derivation = __pyx_cur_scope->__pyx_v_f_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":72 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":72 * for k in range(size): * f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<< @@ -9893,7 +9894,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator */ __pyx_cur_scope->__pyx_v_e_derivation = __pyx_cur_scope->__pyx_v_e_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":73 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":73 * 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 # <<<<<<<<<<<<<< @@ -9913,7 +9914,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator } __pyx_L9:; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":74 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":74 * 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') # <<<<<<<<<<<<<< @@ -9939,7 +9940,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator __pyx_cur_scope->__pyx_v_f_tree = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":75 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":75 * 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') # <<<<<<<<<<<<<< @@ -9965,7 +9966,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator __pyx_cur_scope->__pyx_v_e_tree = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":76 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":76 * 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) # <<<<<<<<<<<<<< @@ -9997,7 +9998,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator __pyx_L8_break:; } - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":78 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":78 * yield (f_tree, e_tree) * finally: * del f_derivations # <<<<<<<<<<<<<< @@ -10021,7 +10022,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator __pyx_L6:; delete __pyx_cur_scope->__pyx_v_f_derivations; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":79 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":79 * finally: * del f_derivations * del e_derivations # <<<<<<<<<<<<<< @@ -10067,7 +10068,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_19kbest_features(PyObject *_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":81 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":81 * del e_derivations * * def kbest_features(self, size): # <<<<<<<<<<<<<< @@ -10137,7 +10138,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":83 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":83 * def kbest_features(self, size): * """hg.kbest_trees(size) -> List of k-best feature vectors in the hypergraph.""" * cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal](self.hg[0], size) # <<<<<<<<<<<<<< @@ -10147,7 +10148,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":87 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":87 * cdef SparseVector fmap * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -10156,7 +10157,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator */ /*try:*/ { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":88 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":88 * cdef unsigned k * try: * for k in range(size): # <<<<<<<<<<<<<< @@ -10167,7 +10168,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_1; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":89 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":89 * try: * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<< @@ -10176,7 +10177,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator */ __pyx_cur_scope->__pyx_v_derivation = __pyx_cur_scope->__pyx_v_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":90 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":90 * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not derivation: break # <<<<<<<<<<<<<< @@ -10190,7 +10191,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator } __pyx_L9:; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":91 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":91 * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not derivation: break * fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -10206,7 +10207,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator __pyx_cur_scope->__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_4); __pyx_t_4 = 0; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":92 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":92 * if not derivation: break * fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](derivation._yield) # <<<<<<<<<<<<<< @@ -10215,7 +10216,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator */ __pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_cur_scope->__pyx_v_derivation->yield); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":93 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":93 * fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](derivation._yield) * yield fmap # <<<<<<<<<<<<<< @@ -10239,7 +10240,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator __pyx_L8_break:; } - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":95 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":95 * yield fmap * finally: * del derivations # <<<<<<<<<<<<<< @@ -10311,7 +10312,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_22sample(PyObject *__pyx_v_s return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":97 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":97 * del derivations * * def sample(self, unsigned n): # <<<<<<<<<<<<<< @@ -10380,7 +10381,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":99 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":99 * def sample(self, unsigned n): * """hg.sample(n) -> Sample of n hypotheses from the hypergraph.""" * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() # <<<<<<<<<<<<<< @@ -10395,7 +10396,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator } __pyx_cur_scope->__pyx_v_hypos = __pyx_t_1; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":100 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":100 * """hg.sample(n) -> Sample of n hypotheses from the hypergraph.""" * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos) # <<<<<<<<<<<<<< @@ -10404,7 +10405,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator */ HypergraphSampler::sample_hypotheses((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, ((struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_rng(__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_hypos); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":102 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":102 * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos) * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -10413,7 +10414,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator */ /*try:*/ { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":103 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":103 * cdef unsigned k * try: * for k in range(hypos.size()): # <<<<<<<<<<<<<< @@ -10424,7 +10425,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_3; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":104 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":104 * try: * for k in range(hypos.size()): * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -10460,7 +10461,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator } } - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":106 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":106 * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8') * finally: * del hypos # <<<<<<<<<<<<<< @@ -10534,7 +10535,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_25sample_trees(PyObject *__p return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":108 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":108 * del hypos * * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<< @@ -10603,7 +10604,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":110 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":110 * def sample_trees(self, unsigned n): * """hg.sample_trees(n) -> Sample of n trees from the hypergraph.""" * cdef vector[string]* trees = new vector[string]() # <<<<<<<<<<<<<< @@ -10618,7 +10619,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator } __pyx_cur_scope->__pyx_v_trees = __pyx_t_1; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":111 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":111 * """hg.sample_trees(n) -> Sample of n trees from the hypergraph.""" * cdef vector[string]* trees = new vector[string]() * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees) # <<<<<<<<<<<<<< @@ -10627,7 +10628,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator */ HypergraphSampler::sample_trees((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, ((struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_rng(__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_trees); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":113 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":113 * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees) * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -10636,7 +10637,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator */ /*try:*/ { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":114 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":114 * cdef unsigned k * try: * for k in range(trees.size()): # <<<<<<<<<<<<<< @@ -10647,7 +10648,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_3; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":115 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":115 * try: * for k in range(trees.size()): * yield unicode(trees[0][k].c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -10683,7 +10684,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator } } - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":117 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":117 * yield unicode(trees[0][k].c_str(), 'utf8') * finally: * del trees # <<<<<<<<<<<<<< @@ -10743,7 +10744,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_28intersect(PyObject *__pyx_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":119 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":119 * del trees * * def intersect(self, inp): # <<<<<<<<<<<<<< @@ -10764,7 +10765,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_27intersect(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("intersect", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":122 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":122 * """hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference.""" * cdef Lattice lat * if isinstance(inp, Lattice): # <<<<<<<<<<<<<< @@ -10775,7 +10776,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_27intersect(struct __pyx_obj __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":123 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":123 * cdef Lattice lat * if isinstance(inp, Lattice): * lat = <Lattice> inp # <<<<<<<<<<<<<< @@ -10787,7 +10788,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_27intersect(struct __pyx_obj goto __pyx_L3; } - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":124 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":124 * if isinstance(inp, Lattice): * lat = <Lattice> inp * elif isinstance(inp, basestring): # <<<<<<<<<<<<<< @@ -10798,7 +10799,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_27intersect(struct __pyx_obj __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":125 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":125 * lat = <Lattice> inp * elif isinstance(inp, basestring): * lat = Lattice(inp) # <<<<<<<<<<<<<< @@ -10819,7 +10820,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_27intersect(struct __pyx_obj } /*else*/ { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":127 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":127 * lat = Lattice(inp) * else: * raise TypeError('cannot intersect hypergraph with %s' % type(inp)) # <<<<<<<<<<<<<< @@ -10842,7 +10843,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_27intersect(struct __pyx_obj } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":128 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":128 * else: * raise TypeError('cannot intersect hypergraph with %s' % type(inp)) * return hypergraph.Intersect(lat.lattice[0], self.hg) # <<<<<<<<<<<<<< @@ -10941,7 +10942,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_30prune(PyObject *__pyx_v_se return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":130 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":130 * return hypergraph.Intersect(lat.lattice[0], self.hg) * * def prune(self, beam_alpha=0, density=0, **kwargs): # <<<<<<<<<<<<<< @@ -10962,7 +10963,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_29prune(struct __pyx_obj_4cd int __pyx_clineno = 0; __Pyx_RefNannySetupContext("prune", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":134 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":134 * beam_alpha: use beam pruning * density: use density pruning""" * cdef hypergraph.EdgeMask* preserve_mask = NULL # <<<<<<<<<<<<<< @@ -10971,7 +10972,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_29prune(struct __pyx_obj_4cd */ __pyx_v_preserve_mask = NULL; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":135 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":135 * density: use density pruning""" * cdef hypergraph.EdgeMask* preserve_mask = NULL * if 'csplit_preserve_full_word' in kwargs: # <<<<<<<<<<<<<< @@ -10982,7 +10983,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_29prune(struct __pyx_obj_4cd __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":136 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":136 * cdef hypergraph.EdgeMask* preserve_mask = NULL * if 'csplit_preserve_full_word' in kwargs: * preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size()) # <<<<<<<<<<<<<< @@ -10991,7 +10992,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_29prune(struct __pyx_obj_4cd */ __pyx_v_preserve_mask = new std::vector<bool>(__pyx_v_self->hg->edges_.size()); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":137 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":137 * 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 # <<<<<<<<<<<<<< @@ -11003,7 +11004,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_29prune(struct __pyx_obj_4cd } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":138 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":138 * 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) # <<<<<<<<<<<<<< @@ -11014,7 +11015,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_29prune(struct __pyx_obj_4cd __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_density); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->hg->PruneInsideOutside(__pyx_t_3, __pyx_t_4, __pyx_v_preserve_mask, 0, 1.0, 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":139 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":139 * preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True * self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False) * if preserve_mask: # <<<<<<<<<<<<<< @@ -11024,7 +11025,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_29prune(struct __pyx_obj_4cd __pyx_t_2 = (__pyx_v_preserve_mask != 0); if (__pyx_t_2) { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":140 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":140 * self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False) * if preserve_mask: * del preserve_mask # <<<<<<<<<<<<<< @@ -11059,7 +11060,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_32lattice(PyObject *__pyx_v_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":142 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":142 * del preserve_mask * * def lattice(self): # TODO direct hg -> lattice conversion in cdec # <<<<<<<<<<<<<< @@ -11079,7 +11080,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_31lattice(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lattice", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":144 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":144 * def lattice(self): # TODO direct hg -> lattice conversion in cdec * """hg.lattice() -> Lattice corresponding to the hypergraph.""" * cdef bytes plf = hypergraph.AsPLF(self.hg[0], True).c_str() # <<<<<<<<<<<<<< @@ -11091,7 +11092,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_31lattice(struct __pyx_obj_4 __pyx_v_plf = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":145 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":145 * """hg.lattice() -> Lattice corresponding to the hypergraph.""" * cdef bytes plf = hypergraph.AsPLF(self.hg[0], True).c_str() * return Lattice(eval(plf)) # <<<<<<<<<<<<<< @@ -11162,7 +11163,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_34plf(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":147 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":147 * return Lattice(eval(plf)) * * def plf(self): # <<<<<<<<<<<<<< @@ -11180,7 +11181,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_33plf(struct __pyx_obj_4cdec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("plf", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":149 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":149 * def plf(self): * """hg.plf() -> Lattice PLF representation corresponding to the hypergraph.""" * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str()) # <<<<<<<<<<<<<< @@ -11227,7 +11228,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_36reweight(PyObject *__pyx_v return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":151 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":151 * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str()) * * def reweight(self, weights): # <<<<<<<<<<<<<< @@ -11247,7 +11248,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("reweight", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":153 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":153 * def reweight(self, weights): * """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector.""" * if isinstance(weights, SparseVector): # <<<<<<<<<<<<<< @@ -11258,7 +11259,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":154 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":154 * """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector.""" * if isinstance(weights, SparseVector): * self.hg.Reweight((<SparseVector> weights).vector[0]) # <<<<<<<<<<<<<< @@ -11269,7 +11270,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_ goto __pyx_L3; } - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":155 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":155 * if isinstance(weights, SparseVector): * self.hg.Reweight((<SparseVector> weights).vector[0]) * elif isinstance(weights, DenseVector): # <<<<<<<<<<<<<< @@ -11280,7 +11281,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":156 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":156 * self.hg.Reweight((<SparseVector> weights).vector[0]) * elif isinstance(weights, DenseVector): * self.hg.Reweight((<DenseVector> weights).vector[0]) # <<<<<<<<<<<<<< @@ -11292,7 +11293,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_ } /*else*/ { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":158 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":158 * self.hg.Reweight((<DenseVector> weights).vector[0]) * else: * raise TypeError('cannot reweight hypergraph with %s' % type(weights)) # <<<<<<<<<<<<<< @@ -11340,7 +11341,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":161 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":161 * * property edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -11407,7 +11408,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Gen __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":163 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":163 * def __get__(self): * cdef unsigned i * for i in range(self.hg.edges_.size()): # <<<<<<<<<<<<<< @@ -11418,7 +11419,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Gen for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":164 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":164 * cdef unsigned i * for i in range(self.hg.edges_.size()): * yield HypergraphEdge().init(self.hg, i) # <<<<<<<<<<<<<< @@ -11470,7 +11471,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":167 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":167 * * property nodes: * def __get__(self): # <<<<<<<<<<<<<< @@ -11537,7 +11538,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Ge __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":169 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":169 * def __get__(self): * cdef unsigned i * for i in range(self.hg.nodes_.size()): # <<<<<<<<<<<<<< @@ -11548,7 +11549,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Ge for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":170 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":170 * cdef unsigned i * for i in range(self.hg.nodes_.size()): * yield HypergraphNode().init(self.hg, i) # <<<<<<<<<<<<<< @@ -11599,7 +11600,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__p return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":173 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":173 * * property goal: * def __get__(self): # <<<<<<<<<<<<<< @@ -11617,7 +11618,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":174 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":174 * property goal: * def __get__(self): * return HypergraphNode().init(self.hg, self.hg.GoalNode()) # <<<<<<<<<<<<<< @@ -11658,7 +11659,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":177 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":177 * * property npaths: * def __get__(self): # <<<<<<<<<<<<<< @@ -11675,7 +11676,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6npaths___get__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":178 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":178 * property npaths: * def __get__(self): * return self.hg.NumberOfPaths() # <<<<<<<<<<<<<< @@ -11713,7 +11714,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_38inside_outside(PyObject *_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":180 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":180 * return self.hg.NumberOfPaths() * * def inside_outside(self): # <<<<<<<<<<<<<< @@ -11737,7 +11738,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("inside_outside", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":182 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":182 * def inside_outside(self): * """hg.inside_outside() -> SparseVector with inside-outside scores for each feature.""" * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() # <<<<<<<<<<<<<< @@ -11746,7 +11747,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __py */ __pyx_v_result = new FastSparseVector<prob_t>(); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":183 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":183 * """hg.inside_outside() -> SparseVector with inside-outside scores for each feature.""" * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() * cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) # <<<<<<<<<<<<<< @@ -11755,7 +11756,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __py */ __pyx_v_z = InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>((__pyx_v_self->hg[0]), __pyx_v_result); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":184 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":184 * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() * cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) * result[0] /= z # <<<<<<<<<<<<<< @@ -11764,7 +11765,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __py */ (__pyx_v_result[0]) /= __pyx_v_z; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":185 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":185 * cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) * result[0] /= z * cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -11777,7 +11778,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __py __pyx_v_vector = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":186 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":186 * result[0] /= z * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double]() # <<<<<<<<<<<<<< @@ -11786,7 +11787,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __py */ __pyx_v_vector->vector = new FastSparseVector<double>(); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":187 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":187 * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double]() * cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False) # <<<<<<<<<<<<<< @@ -11795,7 +11796,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __py */ __pyx_v_it = new FastSparseVector<prob_t>::const_iterator((__pyx_v_result[0]), 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":189 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":189 * cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False) * cdef unsigned i * for i in range(result.size()): # <<<<<<<<<<<<<< @@ -11806,7 +11807,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __py for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":190 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":190 * cdef unsigned i * for i in range(result.size()): * vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) # <<<<<<<<<<<<<< @@ -11815,7 +11816,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __py */ __pyx_v_vector->vector->set_value((__pyx_v_it[0]).operator->()->first, log((__pyx_v_it[0]).operator->()->second)); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":191 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":191 * for i in range(result.size()): * vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) * pinc(it[0]) # ++it # <<<<<<<<<<<<<< @@ -11825,7 +11826,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __py (++(__pyx_v_it[0])); } - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":192 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":192 * vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) * pinc(it[0]) # ++it * del it # <<<<<<<<<<<<<< @@ -11834,7 +11835,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __py */ delete __pyx_v_it; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":193 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":193 * pinc(it[0]) # ++it * del it * del result # <<<<<<<<<<<<<< @@ -11843,7 +11844,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __py */ delete __pyx_v_result; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":194 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":194 * del it * del result * return vector # <<<<<<<<<<<<<< @@ -11868,7 +11869,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __py return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":201 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":201 * cdef public TRule trule * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<< @@ -11885,7 +11886,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd int __pyx_clineno = 0; __Pyx_RefNannySetupContext("init", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":202 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":202 * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg # <<<<<<<<<<<<<< @@ -11894,7 +11895,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd */ __pyx_v_self->hg = __pyx_v_hg; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":203 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":203 * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg * self.edge = &hg.edges_[i] # <<<<<<<<<<<<<< @@ -11903,7 +11904,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd */ __pyx_v_self->edge = (&(__pyx_v_hg->edges_[__pyx_v_i])); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":204 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":204 * self.hg = hg * self.edge = &hg.edges_[i] * self.trule = TRule.__new__(TRule) # <<<<<<<<<<<<<< @@ -11919,7 +11920,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd __pyx_v_self->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":205 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":205 * self.edge = &hg.edges_[i] * self.trule = TRule.__new__(TRule) * self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) # <<<<<<<<<<<<<< @@ -11928,7 +11929,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd */ __pyx_v_self->trule->rule = new boost::shared_ptr<TRule>(__pyx_v_self->edge->rule_); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":206 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":206 * self.trule = TRule.__new__(TRule) * self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) * return self # <<<<<<<<<<<<<< @@ -11963,7 +11964,7 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_14HypergraphEdge_1__len__(PyObject *__py return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":208 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":208 * return self * * def __len__(self): # <<<<<<<<<<<<<< @@ -11976,7 +11977,7 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_14HypergraphEdge___len__(struct __pyx_ob __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":209 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":209 * * def __len__(self): * return self.edge.tail_nodes_.size() # <<<<<<<<<<<<<< @@ -12003,7 +12004,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_9head_node_1__get__(PyOb return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":212 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":212 * * property head_node: * def __get__(self): # <<<<<<<<<<<<<< @@ -12021,7 +12022,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":213 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":213 * property head_node: * def __get__(self): * return HypergraphNode().init(self.hg, self.edge.head_node_) # <<<<<<<<<<<<<< @@ -12063,7 +12064,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(Py return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":216 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":216 * * property tail_nodes: * def __get__(self): # <<<<<<<<<<<<<< @@ -12130,7 +12131,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator1 __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":218 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":218 * def __get__(self): * cdef unsigned i * for i in range(self.edge.tail_nodes_.size()): # <<<<<<<<<<<<<< @@ -12141,7 +12142,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator1 for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":219 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":219 * cdef unsigned i * for i in range(self.edge.tail_nodes_.size()): * yield HypergraphNode().init(self.hg, self.edge.tail_nodes_[i]) # <<<<<<<<<<<<<< @@ -12192,7 +12193,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4span_1__get__(PyObject return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":222 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":222 * * property span: * def __get__(self): # <<<<<<<<<<<<<< @@ -12211,7 +12212,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":223 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":223 * property span: * def __get__(self): * return (self.edge.i_, self.edge.j_) # <<<<<<<<<<<<<< @@ -12260,7 +12261,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_8src_span_1__get__(PyObj return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":226 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":226 * * property src_span: * def __get__(self): # <<<<<<<<<<<<<< @@ -12279,7 +12280,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":227 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":227 * property src_span: * def __get__(self): * return (self.edge.prev_i_, self.edge.prev_j_) # <<<<<<<<<<<<<< @@ -12328,7 +12329,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_14feature_values_1__get_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":230 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":230 * * property feature_values: * def __get__(self): # <<<<<<<<<<<<<< @@ -12346,7 +12347,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":231 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":231 * property feature_values: * def __get__(self): * cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -12359,7 +12360,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__ __pyx_v_vector = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":232 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":232 * def __get__(self): * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double](self.edge.feature_values_) # <<<<<<<<<<<<<< @@ -12368,7 +12369,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__ */ __pyx_v_vector->vector = new FastSparseVector<double>(__pyx_v_self->edge->feature_values_); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":233 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":233 * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double](self.edge.feature_values_) * return vector # <<<<<<<<<<<<<< @@ -12404,7 +12405,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":236 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":236 * * property prob: * def __get__(self): # <<<<<<<<<<<<<< @@ -12421,7 +12422,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4prob___get__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":237 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":237 * property prob: * def __get__(self): * return self.edge.edge_prob_.as_float() # <<<<<<<<<<<<<< @@ -12467,7 +12468,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":239 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":239 * return self.edge.edge_prob_.as_float() * * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<< @@ -12485,7 +12486,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":242 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":242 * if op == 2: # == * return x.edge == y.edge * elif op == 3: # != # <<<<<<<<<<<<<< @@ -12494,7 +12495,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py */ switch (__pyx_v_op) { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":240 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":240 * * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): * if op == 2: # == # <<<<<<<<<<<<<< @@ -12503,7 +12504,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py */ case 2: - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":241 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":241 * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): * if op == 2: # == * return x.edge == y.edge # <<<<<<<<<<<<<< @@ -12518,7 +12519,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py goto __pyx_L0; break; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":242 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":242 * if op == 2: # == * return x.edge == y.edge * elif op == 3: # != # <<<<<<<<<<<<<< @@ -12527,7 +12528,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py */ case 3: - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":243 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":243 * return x.edge == y.edge * elif op == 3: # != * return not (x == y) # <<<<<<<<<<<<<< @@ -12546,7 +12547,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py break; } - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":244 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":244 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<< @@ -12582,7 +12583,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":199 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":199 * cdef hypergraph.Hypergraph* hg * cdef hypergraph.HypergraphEdge* edge * cdef public TRule trule # <<<<<<<<<<<<<< @@ -12667,7 +12668,7 @@ static int __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_o return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":250 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":250 * cdef hypergraph.HypergraphNode* node * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<< @@ -12680,7 +12681,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cd __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":251 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":251 * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg # <<<<<<<<<<<<<< @@ -12689,7 +12690,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cd */ __pyx_v_self->hg = __pyx_v_hg; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":252 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":252 * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg * self.node = &hg.nodes_[i] # <<<<<<<<<<<<<< @@ -12698,12 +12699,12 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cd */ __pyx_v_self->node = (&(__pyx_v_hg->nodes_[__pyx_v_i])); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":253 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":253 * self.hg = hg * self.node = &hg.nodes_[i] * return self # <<<<<<<<<<<<<< * - * property in_edges: + * property id: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); @@ -12716,6 +12717,60 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cd __Pyx_RefNannyFinishContext(); return __pyx_r; } + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_2id_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_2id_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_2id___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":256 + * + * property id: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.node.id_ + * + */ + +static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_2id___get__(struct __pyx_obj_4cdec_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); + + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":257 + * property id: + * def __get__(self): + * return self.node.id_ # <<<<<<<<<<<<<< + * + * property in_edges: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->node->id_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 257; __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._cdec.HypergraphNode.id.__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_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ @@ -12729,7 +12784,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObj return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":256 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":260 * * property in_edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -12755,7 +12810,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_8in_edges___get__(struct __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator12, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator12, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -12794,9 +12849,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator12(_ return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":258 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":262 * def __get__(self): * cdef unsigned i * for i in range(self.node.in_edges_.size()): # <<<<<<<<<<<<<< @@ -12807,16 +12862,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator12(_ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":259 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":263 * 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_4cdec_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *)((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->in_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *)((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->in_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 263; __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; @@ -12831,7 +12886,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator12(_ __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 = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; @@ -12859,7 +12914,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_9out_edges_1__get__(PyOb return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":262 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":266 * * property out_edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -12885,7 +12940,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_9out_edges___get__(struc __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_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -12924,9 +12979,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator13( return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":264 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":268 * def __get__(self): * cdef unsigned i * for i in range(self.node.out_edges_.size()): # <<<<<<<<<<<<<< @@ -12937,16 +12992,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator13( for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":265 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":269 * 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_4cdec_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *)((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->out_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *)((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->out_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __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; @@ -12961,7 +13016,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator13( __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 = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; @@ -12988,7 +13043,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_4span_1__get__(PyObject return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":268 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":272 * * property span: * def __get__(self): # <<<<<<<<<<<<<< @@ -13006,7 +13061,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":269 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":273 * property span: * def __get__(self): * return next(self.in_edges).span # <<<<<<<<<<<<<< @@ -13014,12 +13069,12 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(struct __p * property cat: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__in_edges); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__in_edges); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__span); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__span); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __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; @@ -13050,7 +13105,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_3cat_1__get__(PyObject * return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":272 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":276 * * property cat: * def __get__(self): # <<<<<<<<<<<<<< @@ -13069,7 +13124,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":273 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":277 * property cat: * def __get__(self): * if self.node.cat_: # <<<<<<<<<<<<<< @@ -13079,7 +13134,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __py __pyx_t_1 = (__pyx_v_self->node->cat_ != 0); if (__pyx_t_1) { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":274 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":278 * def __get__(self): * if self.node.cat_: * return str(TDConvert(-self.node.cat_).c_str()) # <<<<<<<<<<<<<< @@ -13087,14 +13142,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __py * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBytes_FromString(TD::Convert((-__pyx_v_self->node->cat_)).c_str()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBytes_FromString(TD::Convert((-__pyx_v_self->node->cat_)).c_str()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 274; __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 = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 278; __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; @@ -13126,8 +13181,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_1__richcmp__(PyObject *_ PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_4cdec_5_cdec_HypergraphNode, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4cdec_5_cdec_HypergraphNode, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_4cdec_5_cdec_HypergraphNode, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4cdec_5_cdec_HypergraphNode, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_x), ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_y), ((int)__pyx_v_op)); goto __pyx_L0; __pyx_L1_error:; @@ -13137,7 +13192,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_1__richcmp__(PyObject *_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":276 +/* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":280 * return str(TDConvert(-self.node.cat_).c_str()) * * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<< @@ -13155,7 +13210,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":279 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":283 * if op == 2: # == * return x.node == y.node * elif op == 3: # != # <<<<<<<<<<<<<< @@ -13164,7 +13219,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx */ switch (__pyx_v_op) { - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":277 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":281 * * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): * if op == 2: # == # <<<<<<<<<<<<<< @@ -13173,7 +13228,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx */ case 2: - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":278 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":282 * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): * if op == 2: # == * return x.node == y.node # <<<<<<<<<<<<<< @@ -13181,14 +13236,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx * return not (x == y) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_x->node == __pyx_v_y->node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_x->node == __pyx_v_y->node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; break; - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":279 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":283 * if op == 2: # == * return x.node == y.node * elif op == 3: # != # <<<<<<<<<<<<<< @@ -13197,17 +13252,17 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx */ case 3: - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":280 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":284 * 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); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13215,16 +13270,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx break; } - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":281 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":285 * 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_21), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -13252,7 +13307,7 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyO return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":6 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":6 * cdef lattice.Lattice* lattice * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -13265,7 +13320,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice___cinit__(struct __pyx_obj_4cdec_5_cde __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":7 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":7 * * def __cinit__(self): * self.lattice = new lattice.Lattice() # <<<<<<<<<<<<<< @@ -13333,7 +13388,7 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyOb return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":9 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":9 * self.lattice = new lattice.Lattice() * * def __init__(self, inp): # <<<<<<<<<<<<<< @@ -13359,7 +13414,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":12 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":12 * """Lattice(tuple) -> Lattice from node list. * Lattice(string) -> Lattice from PLF representation.""" * if isinstance(inp, tuple): # <<<<<<<<<<<<<< @@ -13370,7 +13425,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":13 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":13 * Lattice(string) -> Lattice from PLF representation.""" * if isinstance(inp, tuple): * self.lattice.resize(len(inp)) # <<<<<<<<<<<<<< @@ -13380,7 +13435,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde __pyx_t_3 = PyObject_Length(__pyx_v_inp); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->lattice->resize(__pyx_t_3); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":14 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":14 * if isinstance(inp, tuple): * self.lattice.resize(len(inp)) * for i, arcs in enumerate(inp): # <<<<<<<<<<<<<< @@ -13435,7 +13490,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde __pyx_t_4 = __pyx_t_7; __pyx_t_7 = 0; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":15 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":15 * self.lattice.resize(len(inp)) * for i, arcs in enumerate(inp): * self[i] = arcs # <<<<<<<<<<<<<< @@ -13449,7 +13504,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde goto __pyx_L3; } - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":16 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":16 * for i, arcs in enumerate(inp): * self[i] = arcs * elif isinstance(inp, basestring): # <<<<<<<<<<<<<< @@ -13460,7 +13515,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":17 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":17 * self[i] = arcs * elif isinstance(inp, basestring): * lattice.ConvertTextOrPLF(as_str(inp), self.lattice) # <<<<<<<<<<<<<< @@ -13476,7 +13531,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde } /*else*/ { - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":19 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":19 * lattice.ConvertTextOrPLF(as_str(inp), self.lattice) * else: * raise TypeError('cannot create lattice from %s' % type(inp)) # <<<<<<<<<<<<<< @@ -13523,7 +13578,7 @@ static void __pyx_pw_4cdec_5_cdec_7Lattice_5__dealloc__(PyObject *__pyx_v_self) __Pyx_RefNannyFinishContext(); } -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":21 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":21 * raise TypeError('cannot create lattice from %s' % type(inp)) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -13535,7 +13590,7 @@ static void __pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __p __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":22 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":22 * * def __dealloc__(self): * del self.lattice # <<<<<<<<<<<<<< @@ -13571,7 +13626,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_s return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":24 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":24 * del self.lattice * * def __getitem__(self, int index): # <<<<<<<<<<<<<< @@ -13601,7 +13656,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":25 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":25 * * def __getitem__(self, int index): * if not 0 <= index < len(self): # <<<<<<<<<<<<<< @@ -13616,7 +13671,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_3) { - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":26 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":26 * def __getitem__(self, int index): * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') # <<<<<<<<<<<<<< @@ -13632,7 +13687,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":27 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":27 * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') * arcs = [] # <<<<<<<<<<<<<< @@ -13644,7 +13699,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c __pyx_v_arcs = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":28 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":28 * raise IndexError('lattice index out of range') * arcs = [] * cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index] # <<<<<<<<<<<<<< @@ -13653,7 +13708,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c */ __pyx_v_arc_vector = ((__pyx_v_self->lattice[0])[__pyx_v_index]); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":31 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":31 * cdef lattice.LatticeArc* arc * cdef unsigned i * for i in range(arc_vector.size()): # <<<<<<<<<<<<<< @@ -13664,7 +13719,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":32 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":32 * cdef unsigned i * for i in range(arc_vector.size()): * arc = &arc_vector[i] # <<<<<<<<<<<<<< @@ -13673,7 +13728,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c */ __pyx_v_arc = (&(__pyx_v_arc_vector[__pyx_v_i])); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":33 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":33 * for i in range(arc_vector.size()): * arc = &arc_vector[i] * label = unicode(TDConvert(arc.label).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -13697,7 +13752,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c __pyx_v_label = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":34 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":34 * arc = &arc_vector[i] * label = unicode(TDConvert(arc.label).c_str(), 'utf8') * arcs.append((label, arc.cost, arc.dist2next)) # <<<<<<<<<<<<<< @@ -13723,7 +13778,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; } - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":35 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":35 * label = unicode(TDConvert(arc.label).c_str(), 'utf8') * arcs.append((label, arc.cost, arc.dist2next)) * return tuple(arcs) # <<<<<<<<<<<<<< @@ -13782,7 +13837,7 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, P return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":37 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":37 * return tuple(arcs) * * def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<< @@ -13816,7 +13871,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":38 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":38 * * def __setitem__(self, int index, tuple arcs): * if not 0 <= index < len(self): # <<<<<<<<<<<<<< @@ -13831,7 +13886,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_ __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_3) { - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":39 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":39 * def __setitem__(self, int index, tuple arcs): * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') # <<<<<<<<<<<<<< @@ -13847,7 +13902,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_ } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":41 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":41 * raise IndexError('lattice index out of range') * cdef lattice.LatticeArc* arc * for (label, cost, dist2next) in arcs: # <<<<<<<<<<<<<< @@ -13934,7 +13989,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_ __pyx_v_dist2next = __pyx_t_8; __pyx_t_8 = 0; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":42 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":42 * cdef lattice.LatticeArc* arc * for (label, cost, dist2next) in arcs: * label_str = as_str(label) # <<<<<<<<<<<<<< @@ -13947,7 +14002,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_ __pyx_v_label_str = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":43 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":43 * for (label, cost, dist2next) in arcs: * label_str = as_str(label) * arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next) # <<<<<<<<<<<<<< @@ -13959,7 +14014,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_ __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_dist2next); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_arc = new LatticeArc(TD::Convert(__pyx_t_11), __pyx_t_12, __pyx_t_13); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":44 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":44 * label_str = as_str(label) * arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next) * self.lattice[0][index].push_back(arc[0]) # <<<<<<<<<<<<<< @@ -13968,7 +14023,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_ */ ((__pyx_v_self->lattice[0])[__pyx_v_index]).push_back((__pyx_v_arc[0])); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":45 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":45 * arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next) * self.lattice[0][index].push_back(arc[0]) * del arc # <<<<<<<<<<<<<< @@ -14010,7 +14065,7 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":47 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":47 * del arc * * def __len__(self): # <<<<<<<<<<<<<< @@ -14023,7 +14078,7 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_7Lattice_10__len__(struct __pyx_obj_4cde __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":48 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":48 * * def __len__(self): * return self.lattice.size() # <<<<<<<<<<<<<< @@ -14050,7 +14105,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":50 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":50 * return self.lattice.size() * * def __str__(self): # <<<<<<<<<<<<<< @@ -14068,7 +14123,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_12__str__(struct __pyx_obj_4cdec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":51 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":51 * * def __str__(self): * return str(hypergraph.AsPLF(self.lattice[0], True).c_str()) # <<<<<<<<<<<<<< @@ -14114,7 +14169,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":53 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":53 * return str(hypergraph.AsPLF(self.lattice[0], True).c_str()) * * def __unicode__(self): # <<<<<<<<<<<<<< @@ -14132,7 +14187,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__unicode__", 0); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":54 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":54 * * def __unicode__(self): * return unicode(str(self), 'utf8') # <<<<<<<<<<<<<< @@ -14188,7 +14243,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":56 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":56 * return unicode(str(self), 'utf8') * * def __iter__(self): # <<<<<<<<<<<<<< @@ -14254,7 +14309,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator14(__pyx_GeneratorObj __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":58 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":58 * def __iter__(self): * cdef unsigned i * for i in range(len(self)): # <<<<<<<<<<<<<< @@ -14265,7 +14320,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator14(__pyx_GeneratorObj for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":59 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":59 * cdef unsigned i * for i in range(len(self)): * yield self[i] # <<<<<<<<<<<<<< @@ -14326,7 +14381,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_se return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":63 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":63 * def todot(self): * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" * def lines(): # <<<<<<<<<<<<<< @@ -14406,7 +14461,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator20(__pyx_Genera __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":64 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":64 * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" * def lines(): * yield 'digraph lattice {' # <<<<<<<<<<<<<< @@ -14423,7 +14478,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator20(__pyx_Genera __pyx_L4_resume_from_yield:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":65 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":65 * def lines(): * yield 'digraph lattice {' * yield 'rankdir = LR;' # <<<<<<<<<<<<<< @@ -14440,7 +14495,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator20(__pyx_Genera __pyx_L5_resume_from_yield:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":66 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":66 * yield 'digraph lattice {' * yield 'rankdir = LR;' * yield 'node [shape=circle];' # <<<<<<<<<<<<<< @@ -14457,7 +14512,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator20(__pyx_Genera __pyx_L6_resume_from_yield:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":67 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":67 * yield 'rankdir = LR;' * yield 'node [shape=circle];' * for i in range(len(self)): # <<<<<<<<<<<<<< @@ -14520,7 +14575,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator20(__pyx_Genera __pyx_cur_scope->__pyx_v_i = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":68 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":68 * yield 'node [shape=circle];' * for i in range(len(self)): * for label, weight, delta in self[i]: # <<<<<<<<<<<<<< @@ -14638,7 +14693,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator20(__pyx_Genera __pyx_cur_scope->__pyx_v_delta = __pyx_t_10; __pyx_t_10 = 0; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":69 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":69 * for i in range(len(self)): * for label, weight, delta in self[i]: * yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) # <<<<<<<<<<<<<< @@ -14698,7 +14753,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator20(__pyx_Genera } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":70 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":70 * for label, weight, delta in self[i]: * yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) * yield '%d [shape=doublecircle]' % len(self) # <<<<<<<<<<<<<< @@ -14724,7 +14779,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator20(__pyx_Genera __pyx_L14_resume_from_yield:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":71 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":71 * yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) * yield '%d [shape=doublecircle]' % len(self) * yield '}' # <<<<<<<<<<<<<< @@ -14759,7 +14814,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator20(__pyx_Genera return NULL; } -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":61 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":61 * yield self[i] * * def todot(self): # <<<<<<<<<<<<<< @@ -14789,7 +14844,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_19todot(struct __pyx_obj_4cdec_5 __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":63 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":63 * def todot(self): * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" * def lines(): # <<<<<<<<<<<<<< @@ -14801,7 +14856,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_19todot(struct __pyx_obj_4cdec_5 __pyx_v_lines = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":72 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":72 * yield '%d [shape=doublecircle]' % len(self) * yield '}' * return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<< @@ -14860,7 +14915,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_22as_hypergraph(PyObject *__pyx_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":74 +/* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":74 * return '\n'.join(lines()).encode('utf8') * * def as_hypergraph(self): # <<<<<<<<<<<<<< @@ -14881,7 +14936,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("as_hypergraph", 0); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":76 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":76 * def as_hypergraph(self): * """lattice.as_hypergraph() -> Hypergraph representation of the lattice.""" * cdef Hypergraph result = Hypergraph.__new__(Hypergraph) # <<<<<<<<<<<<<< @@ -14894,7 +14949,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj __pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":77 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":77 * """lattice.as_hypergraph() -> Hypergraph representation of the lattice.""" * cdef Hypergraph result = Hypergraph.__new__(Hypergraph) * result.hg = new hypergraph.Hypergraph() # <<<<<<<<<<<<<< @@ -14903,7 +14958,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj */ __pyx_v_result->hg = new Hypergraph(); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":78 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":78 * cdef Hypergraph result = Hypergraph.__new__(Hypergraph) * result.hg = new hypergraph.Hypergraph() * cdef bytes plf = str(self) # <<<<<<<<<<<<<< @@ -14922,7 +14977,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj __pyx_v_plf = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":79 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":79 * result.hg = new hypergraph.Hypergraph() * cdef bytes plf = str(self) * hypergraph.ReadFromPLF(plf, result.hg) # <<<<<<<<<<<<<< @@ -14931,7 +14986,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj __pyx_t_3 = __pyx_convert_string_from_py_(((PyObject *)__pyx_v_plf)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} HypergraphIO::ReadFromPLF(__pyx_t_3, __pyx_v_result->hg); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":80 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":80 * cdef bytes plf = str(self) * hypergraph.ReadFromPLF(plf, result.hg) * return result # <<<<<<<<<<<<<< @@ -14956,7 +15011,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":3 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":3 * cimport mteval * * cdef SufficientStats as_stats(x, y): # <<<<<<<<<<<<<< @@ -14978,7 +15033,7 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("as_stats", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":4 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":4 * * cdef SufficientStats as_stats(x, y): * if isinstance(x, SufficientStats): # <<<<<<<<<<<<<< @@ -14989,7 +15044,7 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":5 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":5 * cdef SufficientStats as_stats(x, y): * if isinstance(x, SufficientStats): * return x # <<<<<<<<<<<<<< @@ -15004,7 +15059,7 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st goto __pyx_L3; } - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":6 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":6 * if isinstance(x, SufficientStats): * return x * elif x == 0 and isinstance(y, SufficientStats): # <<<<<<<<<<<<<< @@ -15022,7 +15077,7 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st } if (__pyx_t_4) { - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":7 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":7 * return x * elif x == 0 and isinstance(y, SufficientStats): * stats = SufficientStats() # <<<<<<<<<<<<<< @@ -15034,7 +15089,7 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st __pyx_v_stats = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":8 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":8 * elif x == 0 and isinstance(y, SufficientStats): * stats = SufficientStats() * stats.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<< @@ -15043,7 +15098,7 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st */ __pyx_v_stats->stats = new SufficientStats(); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":9 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":9 * stats = SufficientStats() * stats.stats = new mteval.SufficientStats() * stats.metric = (<SufficientStats> y).metric # <<<<<<<<<<<<<< @@ -15053,7 +15108,7 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st __pyx_t_5 = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_y)->metric; __pyx_v_stats->metric = __pyx_t_5; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":10 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":10 * stats.stats = new mteval.SufficientStats() * stats.metric = (<SufficientStats> y).metric * return stats # <<<<<<<<<<<<<< @@ -15092,7 +15147,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5words_1__get__(PyObject *__py return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":17 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":17 * * property words: * def __get__(self): # <<<<<<<<<<<<<< @@ -15111,7 +15166,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":18 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":18 * property words: * def __get__(self): * return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8') # <<<<<<<<<<<<<< @@ -15162,7 +15217,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":21 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":21 * * property fmap: * def __get__(self): # <<<<<<<<<<<<<< @@ -15180,7 +15235,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":22 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":22 * property fmap: * def __get__(self): * cdef SparseVector fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< @@ -15193,7 +15248,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj __pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":23 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":23 * def __get__(self): * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) # <<<<<<<<<<<<<< @@ -15202,7 +15257,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj */ __pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_v_self->candidate->fmap); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":24 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":24 * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) * return fmap # <<<<<<<<<<<<<< @@ -15238,7 +15293,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5score_1__get__(PyObject *__py return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":14 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":14 * cdef class Candidate: * cdef mteval.const_Candidate* candidate * cdef public float score # <<<<<<<<<<<<<< @@ -15314,7 +15369,7 @@ static void __pyx_pw_4cdec_5_cdec_15SufficientStats_1__dealloc__(PyObject *__pyx __Pyx_RefNannyFinishContext(); } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":30 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":30 * cdef mteval.EvaluationMetric* metric * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -15326,7 +15381,7 @@ static void __pyx_pf_4cdec_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED st __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":31 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":31 * * def __dealloc__(self): * del self.stats # <<<<<<<<<<<<<< @@ -15349,7 +15404,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_5score_1__get__(PyObjec return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":34 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":34 * * property score: * def __get__(self): # <<<<<<<<<<<<<< @@ -15366,7 +15421,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":35 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":35 * property score: * def __get__(self): * return self.metric.ComputeScore(self.stats[0]) # <<<<<<<<<<<<<< @@ -15403,7 +15458,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_6detail_1__get__(PyObje return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":38 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":38 * * property detail: * def __get__(self): # <<<<<<<<<<<<<< @@ -15421,7 +15476,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":39 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":39 * property detail: * def __get__(self): * return str(self.metric.DetailedScore(self.stats[0]).c_str()) # <<<<<<<<<<<<<< @@ -15467,7 +15522,7 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_15SufficientStats_3__len__(PyObject *__p return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":41 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":41 * return str(self.metric.DetailedScore(self.stats[0]).c_str()) * * def __len__(self): # <<<<<<<<<<<<<< @@ -15480,7 +15535,7 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_15SufficientStats_2__len__(struct __pyx_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":42 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":42 * * def __len__(self): * return self.stats.size() # <<<<<<<<<<<<<< @@ -15508,7 +15563,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_5__iter__(PyObject *__p return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":44 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":44 * return self.stats.size() * * def __iter__(self): # <<<<<<<<<<<<<< @@ -15575,7 +15630,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator15(__pyx_Gene __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":45 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":45 * * def __iter__(self): * for i in range(len(self)): # <<<<<<<<<<<<<< @@ -15634,7 +15689,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator15(__pyx_Gene __pyx_cur_scope->__pyx_v_i = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":46 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":46 * def __iter__(self): * for i in range(len(self)): * yield self[i] # <<<<<<<<<<<<<< @@ -15701,7 +15756,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_8__getitem__(PyObject * return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":48 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":48 * yield self[i] * * def __getitem__(self, int index): # <<<<<<<<<<<<<< @@ -15721,7 +15776,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":49 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":49 * * def __getitem__(self, int index): * if not 0 <= index < len(self): # <<<<<<<<<<<<<< @@ -15736,7 +15791,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __p __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_3) { - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":50 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":50 * def __getitem__(self, int index): * if not 0 <= index < len(self): * raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<< @@ -15752,7 +15807,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __p } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":51 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":51 * if not 0 <= index < len(self): * raise IndexError('sufficient stats vector index out of range') * return self.stats[0][index] # <<<<<<<<<<<<<< @@ -15797,7 +15852,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_10__iadd__(PyObject *__ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":53 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":53 * return self.stats[0][index] * * def __iadd__(SufficientStats self, SufficientStats other): # <<<<<<<<<<<<<< @@ -15810,7 +15865,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__iadd__(struct __pyx_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iadd__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":54 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":54 * * def __iadd__(SufficientStats self, SufficientStats other): * self.stats[0] += other.stats[0] # <<<<<<<<<<<<<< @@ -15819,7 +15874,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__iadd__(struct __pyx_ */ (__pyx_v_self->stats[0]) += (__pyx_v_other->stats[0]); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":55 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":55 * def __iadd__(SufficientStats self, SufficientStats other): * self.stats[0] += other.stats[0] * return self # <<<<<<<<<<<<<< @@ -15849,7 +15904,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_12__add__(PyObject *__p return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":57 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":57 * return self * * def __add__(x, y): # <<<<<<<<<<<<<< @@ -15870,7 +15925,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__add__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":58 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":58 * * def __add__(x, y): * cdef SufficientStats sx = as_stats(x, y) # <<<<<<<<<<<<<< @@ -15882,7 +15937,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p __pyx_v_sx = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":59 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":59 * def __add__(x, y): * cdef SufficientStats sx = as_stats(x, y) * cdef SufficientStats sy = as_stats(y, x) # <<<<<<<<<<<<<< @@ -15894,7 +15949,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p __pyx_v_sy = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":60 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":60 * cdef SufficientStats sx = as_stats(x, y) * cdef SufficientStats sy = as_stats(y, x) * cdef SufficientStats result = SufficientStats() # <<<<<<<<<<<<<< @@ -15906,7 +15961,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p __pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":61 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":61 * cdef SufficientStats sy = as_stats(y, x) * cdef SufficientStats result = SufficientStats() * result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) # <<<<<<<<<<<<<< @@ -15915,7 +15970,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p */ __pyx_v_result->stats = new SufficientStats(operator+((__pyx_v_sx->stats[0]), (__pyx_v_sy->stats[0]))); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":62 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":62 * cdef SufficientStats result = SufficientStats() * result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) * result.metric = sx.metric # <<<<<<<<<<<<<< @@ -15925,7 +15980,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p __pyx_t_2 = __pyx_v_sx->metric; __pyx_v_result->metric = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":63 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":63 * result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) * result.metric = sx.metric * return result # <<<<<<<<<<<<<< @@ -16007,7 +16062,7 @@ static int __pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_sel return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":70 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":70 * cdef mteval.CandidateSet* cs * * def __cinit__(self, SegmentEvaluator evaluator): # <<<<<<<<<<<<<< @@ -16021,7 +16076,7 @@ static int __pyx_pf_4cdec_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_4cdec EvaluationMetric *__pyx_t_1; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":71 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":71 * * def __cinit__(self, SegmentEvaluator evaluator): * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) # <<<<<<<<<<<<<< @@ -16030,7 +16085,7 @@ static int __pyx_pf_4cdec_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_4cdec */ __pyx_v_self->scorer = new boost::shared_ptr<SegmentEvaluator>((__pyx_v_evaluator->scorer[0])); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":72 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":72 * def __cinit__(self, SegmentEvaluator evaluator): * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) * self.metric = evaluator.metric # <<<<<<<<<<<<<< @@ -16040,7 +16095,7 @@ static int __pyx_pf_4cdec_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_4cdec __pyx_t_1 = __pyx_v_evaluator->metric; __pyx_v_self->metric = __pyx_t_1; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":73 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":73 * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) * self.metric = evaluator.metric * self.cs = new mteval.CandidateSet() # <<<<<<<<<<<<<< @@ -16063,7 +16118,7 @@ static void __pyx_pw_4cdec_5_cdec_12CandidateSet_3__dealloc__(PyObject *__pyx_v_ __Pyx_RefNannyFinishContext(); } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":75 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":75 * self.cs = new mteval.CandidateSet() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -16075,7 +16130,7 @@ static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED stru __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":76 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":76 * * def __dealloc__(self): * del self.scorer # <<<<<<<<<<<<<< @@ -16084,7 +16139,7 @@ static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED stru */ delete __pyx_v_self->scorer; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":77 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":77 * def __dealloc__(self): * del self.scorer * del self.cs # <<<<<<<<<<<<<< @@ -16107,7 +16162,7 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":79 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":79 * del self.cs * * def __len__(self): # <<<<<<<<<<<<<< @@ -16120,7 +16175,7 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_12CandidateSet_4__len__(struct __pyx_obj __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":80 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":80 * * def __len__(self): * return self.cs.size() # <<<<<<<<<<<<<< @@ -16160,7 +16215,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_7__getitem__(PyObject *__p return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":82 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":82 * return self.cs.size() * * def __getitem__(self,int k): # <<<<<<<<<<<<<< @@ -16180,7 +16235,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":83 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":83 * * def __getitem__(self,int k): * if not 0 <= k < self.cs.size(): # <<<<<<<<<<<<<< @@ -16194,7 +16249,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_ __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":84 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":84 * def __getitem__(self,int k): * if not 0 <= k < self.cs.size(): * raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<< @@ -16210,7 +16265,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_ } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":85 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":85 * if not 0 <= k < self.cs.size(): * raise IndexError('candidate set index out of range') * cdef Candidate candidate = Candidate() # <<<<<<<<<<<<<< @@ -16222,7 +16277,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_ __pyx_v_candidate = ((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":86 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":86 * raise IndexError('candidate set index out of range') * cdef Candidate candidate = Candidate() * candidate.candidate = &self.cs[0][k] # <<<<<<<<<<<<<< @@ -16231,7 +16286,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_ */ __pyx_v_candidate->candidate = (&((__pyx_v_self->cs[0])[__pyx_v_k])); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":87 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":87 * cdef Candidate candidate = Candidate() * candidate.candidate = &self.cs[0][k] * candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats) # <<<<<<<<<<<<<< @@ -16240,7 +16295,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_ */ __pyx_v_candidate->score = __pyx_v_self->metric->ComputeScore(((__pyx_v_self->cs[0])[__pyx_v_k]).eval_feats); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":88 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":88 * candidate.candidate = &self.cs[0][k] * candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats) * return candidate # <<<<<<<<<<<<<< @@ -16277,7 +16332,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":90 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":90 * return candidate * * def __iter__(self): # <<<<<<<<<<<<<< @@ -16343,7 +16398,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator16(__pyx_Genera __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":92 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":92 * def __iter__(self): * cdef unsigned i * for i in range(len(self)): # <<<<<<<<<<<<<< @@ -16354,7 +16409,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator16(__pyx_Genera for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":93 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":93 * cdef unsigned i * for i in range(len(self)): * yield self[i] # <<<<<<<<<<<<<< @@ -16455,7 +16510,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest(PyObject *__py return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":95 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":95 * yield self[i] * * def add_kbest(self, Hypergraph hypergraph, unsigned k): # <<<<<<<<<<<<<< @@ -16468,7 +16523,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_11add_kbest(struct __pyx_o __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_kbest", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":98 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":98 * """cs.add_kbest(Hypergraph hypergraph, int k) -> Extract K-best hypotheses * from the hypergraph and add them to the candidate set.""" * self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get()) # <<<<<<<<<<<<<< @@ -16492,7 +16547,7 @@ static void __pyx_pw_4cdec_5_cdec_16SegmentEvaluator_1__dealloc__(PyObject *__py __Pyx_RefNannyFinishContext(); } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":104 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":104 * cdef mteval.EvaluationMetric* metric * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -16504,7 +16559,7 @@ static void __pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED s __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":105 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":105 * * def __dealloc__(self): * del self.scorer # <<<<<<<<<<<<<< @@ -16528,7 +16583,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_3evaluate(PyObject *__ return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":107 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":107 * del self.scorer * * def evaluate(self, sentence): # <<<<<<<<<<<<<< @@ -16550,7 +16605,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("evaluate", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":110 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":110 * """se.evaluate(sentence) -> SufficientStats for the given hypothesis.""" * cdef vector[WordID] hyp * cdef SufficientStats sf = SufficientStats() # <<<<<<<<<<<<<< @@ -16562,7 +16617,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx __pyx_v_sf = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":111 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":111 * cdef vector[WordID] hyp * cdef SufficientStats sf = SufficientStats() * sf.metric = self.metric # <<<<<<<<<<<<<< @@ -16572,7 +16627,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx __pyx_t_2 = __pyx_v_self->metric; __pyx_v_sf->metric = __pyx_t_2; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":112 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":112 * cdef SufficientStats sf = SufficientStats() * sf.metric = self.metric * sf.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<< @@ -16581,7 +16636,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx */ __pyx_v_sf->stats = new SufficientStats(); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":113 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":113 * sf.metric = self.metric * sf.stats = new mteval.SufficientStats() * ConvertSentence(as_str(sentence.strip()), &hyp) # <<<<<<<<<<<<<< @@ -16600,7 +16655,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; TD::ConvertSentence(__pyx_t_4, (&__pyx_v_hyp)); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":114 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":114 * sf.stats = new mteval.SufficientStats() * ConvertSentence(as_str(sentence.strip()), &hyp) * self.scorer.get().Evaluate(hyp, sf.stats) # <<<<<<<<<<<<<< @@ -16609,7 +16664,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx */ __pyx_v_self->scorer->get()->Evaluate(__pyx_v_hyp, __pyx_v_sf->stats); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":115 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":115 * ConvertSentence(as_str(sentence.strip()), &hyp) * self.scorer.get().Evaluate(hyp, sf.stats) * return sf # <<<<<<<<<<<<<< @@ -16647,7 +16702,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_5candidate_set(PyObjec return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":117 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":117 * return sf * * def candidate_set(self): # <<<<<<<<<<<<<< @@ -16665,7 +16720,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("candidate_set", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":119 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":119 * def candidate_set(self): * """se.candidate_set() -> Candidate set using this segment evaluator for scoring.""" * return CandidateSet(self) # <<<<<<<<<<<<<< @@ -16712,7 +16767,7 @@ static int __pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyOb static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0}; PyObject* values[1] = {0}; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":125 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":125 * cdef mteval.EvaluationMetric* metric * * def __cinit__(self, bytes name=None): # <<<<<<<<<<<<<< @@ -16777,7 +16832,7 @@ static int __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(struct __pyx_obj_4cdec_5_cdec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":126 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":126 * * def __cinit__(self, bytes name=None): * if name: # <<<<<<<<<<<<<< @@ -16787,7 +16842,7 @@ static int __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(struct __pyx_obj_4cdec_5_cdec __pyx_t_1 = (((PyObject *)__pyx_v_name) != Py_None) && (PyBytes_GET_SIZE(((PyObject *)__pyx_v_name)) != 0); if (__pyx_t_1) { - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":127 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":127 * def __cinit__(self, bytes name=None): * if name: * self.name = new string(name) # <<<<<<<<<<<<<< @@ -16803,7 +16858,7 @@ static int __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(struct __pyx_obj_4cdec_5_cdec } __pyx_v_self->name = __pyx_t_3; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":128 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":128 * if name: * self.name = new string(name) * self.metric = mteval.MetricInstance(self.name[0]) # <<<<<<<<<<<<<< @@ -16834,7 +16889,7 @@ static void __pyx_pw_4cdec_5_cdec_6Scorer_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":130 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":130 * self.metric = mteval.MetricInstance(self.name[0]) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -16846,7 +16901,7 @@ static void __pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":131 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":131 * * def __dealloc__(self): * del self.name # <<<<<<<<<<<<<< @@ -16908,7 +16963,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":133 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":133 * del self.name * * def __call__(self, refs): # <<<<<<<<<<<<<< @@ -16940,7 +16995,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_ __Pyx_RefNannySetupContext("__call__", 0); __Pyx_INCREF(__pyx_v_refs); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":134 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":134 * * def __call__(self, refs): * if isinstance(refs, basestring): # <<<<<<<<<<<<<< @@ -16951,7 +17006,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":135 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":135 * def __call__(self, refs): * if isinstance(refs, basestring): * refs = [refs] # <<<<<<<<<<<<<< @@ -16970,7 +17025,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_ } __pyx_L3:; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":136 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":136 * if isinstance(refs, basestring): * refs = [refs] * cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() # <<<<<<<<<<<<<< @@ -16985,7 +17040,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_ } __pyx_v_refsv = __pyx_t_4; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":138 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":138 * cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() * cdef vector[WordID]* refv * for ref in refs: # <<<<<<<<<<<<<< @@ -17030,7 +17085,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_ __pyx_v_ref = __pyx_t_7; __pyx_t_7 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":139 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":139 * cdef vector[WordID]* refv * for ref in refs: * refv = new vector[WordID]() # <<<<<<<<<<<<<< @@ -17045,7 +17100,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_ } __pyx_v_refv = __pyx_t_8; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":140 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":140 * for ref in refs: * refv = new vector[WordID]() * ConvertSentence(as_str(ref.strip()), refv) # <<<<<<<<<<<<<< @@ -17064,7 +17119,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; TD::ConvertSentence(__pyx_t_10, __pyx_v_refv); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":141 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":141 * refv = new vector[WordID]() * ConvertSentence(as_str(ref.strip()), refv) * refsv.push_back(refv[0]) # <<<<<<<<<<<<<< @@ -17073,7 +17128,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_ */ __pyx_v_refsv->push_back((__pyx_v_refv[0])); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":142 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":142 * ConvertSentence(as_str(ref.strip()), refv) * refsv.push_back(refv[0]) * del refv # <<<<<<<<<<<<<< @@ -17084,7 +17139,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":144 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":144 * del refv * cdef unsigned i * cdef SegmentEvaluator evaluator = SegmentEvaluator() # <<<<<<<<<<<<<< @@ -17096,7 +17151,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_ __pyx_v_evaluator = ((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":145 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":145 * cdef unsigned i * cdef SegmentEvaluator evaluator = SegmentEvaluator() * evaluator.metric = self.metric # <<<<<<<<<<<<<< @@ -17106,7 +17161,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_ __pyx_t_11 = __pyx_v_self->metric; __pyx_v_evaluator->metric = __pyx_t_11; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":146 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":146 * cdef SegmentEvaluator evaluator = SegmentEvaluator() * evaluator.metric = self.metric * evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator]( # <<<<<<<<<<<<<< @@ -17115,7 +17170,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_ */ __pyx_v_evaluator->scorer = new boost::shared_ptr<SegmentEvaluator>(__pyx_v_self->metric->CreateSegmentEvaluator((__pyx_v_refsv[0]))); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":148 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":148 * evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator]( * self.metric.CreateSegmentEvaluator(refsv[0])) * del refsv # in theory should not delete but store in SegmentEvaluator # <<<<<<<<<<<<<< @@ -17124,7 +17179,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_ */ delete __pyx_v_refsv; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":149 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":149 * self.metric.CreateSegmentEvaluator(refsv[0])) * del refsv # in theory should not delete but store in SegmentEvaluator * return evaluator # <<<<<<<<<<<<<< @@ -17164,7 +17219,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self) return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":151 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":151 * return evaluator * * def __str__(self): # <<<<<<<<<<<<<< @@ -17182,7 +17237,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_6__str__(struct __pyx_obj_4cdec_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":152 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":152 * * def __str__(self): * return str(self.name.c_str()) # <<<<<<<<<<<<<< @@ -17217,7 +17272,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_6__str__(struct __pyx_obj_4cdec_5 return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":154 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":154 * return str(self.name.c_str()) * * cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): # <<<<<<<<<<<<<< @@ -17243,7 +17298,7 @@ static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, Sufficie int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_compute_score", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":155 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":155 * * cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): * cdef Metric metric = <Metric> metric_ # <<<<<<<<<<<<<< @@ -17253,7 +17308,7 @@ static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, Sufficie __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_metric_))); __pyx_v_metric = ((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_metric_); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":156 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":156 * cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): * cdef Metric metric = <Metric> metric_ * cdef list ss = [] # <<<<<<<<<<<<<< @@ -17265,7 +17320,7 @@ static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, Sufficie __pyx_v_ss = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":158 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":158 * cdef list ss = [] * cdef unsigned i * for i in range(stats.size()): # <<<<<<<<<<<<<< @@ -17276,7 +17331,7 @@ static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, Sufficie for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":159 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":159 * cdef unsigned i * for i in range(stats.size()): * ss.append(stats[0][i]) # <<<<<<<<<<<<<< @@ -17289,7 +17344,7 @@ static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, Sufficie __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":160 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":160 * for i in range(stats.size()): * ss.append(stats[0][i]) * return metric.score(ss) # <<<<<<<<<<<<<< @@ -17327,7 +17382,7 @@ static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, Sufficie return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":162 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":162 * return metric.score(ss) * * cdef void _compute_sufficient_stats(void* metric_, # <<<<<<<<<<<<<< @@ -17354,7 +17409,7 @@ static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_compute_sufficient_stats", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":166 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":166 * vector[string]* refs, * mteval.SufficientStats* out): * cdef Metric metric = <Metric> metric_ # <<<<<<<<<<<<<< @@ -17364,7 +17419,7 @@ static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_ __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_metric_))); __pyx_v_metric = ((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_metric_); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":167 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":167 * mteval.SufficientStats* out): * cdef Metric metric = <Metric> metric_ * cdef list refs_ = [] # <<<<<<<<<<<<<< @@ -17376,7 +17431,7 @@ static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_ __pyx_v_refs_ = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":169 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":169 * cdef list refs_ = [] * cdef unsigned i * for i in range(refs.size()): # <<<<<<<<<<<<<< @@ -17387,7 +17442,7 @@ static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":170 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":170 * cdef unsigned i * for i in range(refs.size()): * refs_.append(str(refs[0][i].c_str())) # <<<<<<<<<<<<<< @@ -17408,7 +17463,7 @@ static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":171 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":171 * for i in range(refs.size()): * refs_.append(str(refs[0][i].c_str())) * cdef list ss = metric.evaluate(str(hyp.c_str()), refs_) # <<<<<<<<<<<<<< @@ -17443,7 +17498,7 @@ static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_ __pyx_v_ss = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":172 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":172 * refs_.append(str(refs[0][i].c_str())) * cdef list ss = metric.evaluate(str(hyp.c_str()), refs_) * out.fields.resize(len(ss)) # <<<<<<<<<<<<<< @@ -17457,7 +17512,7 @@ static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_ __pyx_t_7 = PyList_GET_SIZE(((PyObject *)__pyx_v_ss)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_out->fields.resize(__pyx_t_7); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":173 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":173 * cdef list ss = metric.evaluate(str(hyp.c_str()), refs_) * out.fields.resize(len(ss)) * for i in range(len(ss)): # <<<<<<<<<<<<<< @@ -17472,7 +17527,7 @@ static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_7; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":174 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":174 * out.fields.resize(len(ss)) * for i in range(len(ss)): * out.fields[i] = ss[i] # <<<<<<<<<<<<<< @@ -17517,7 +17572,7 @@ static int __pyx_pw_4cdec_5_cdec_6Metric_1__cinit__(PyObject *__pyx_v_self, PyOb return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":178 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":178 * cdef class Metric: * cdef Scorer scorer * def __cinit__(self): # <<<<<<<<<<<<<< @@ -17538,7 +17593,7 @@ static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":179 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":179 * cdef Scorer scorer * def __cinit__(self): * self.scorer = Scorer() # <<<<<<<<<<<<<< @@ -17553,7 +17608,7 @@ static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec __pyx_v_self->scorer = ((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":180 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":180 * def __cinit__(self): * self.scorer = Scorer() * cdef bytes class_name = self.__class__.__name__ # <<<<<<<<<<<<<< @@ -17569,7 +17624,7 @@ static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec __pyx_v_class_name = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":181 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":181 * self.scorer = Scorer() * cdef bytes class_name = self.__class__.__name__ * self.scorer.name = new string(class_name) # <<<<<<<<<<<<<< @@ -17585,7 +17640,7 @@ static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec } __pyx_v_self->scorer->name = __pyx_t_4; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":182 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":182 * cdef bytes class_name = self.__class__.__name__ * self.scorer.name = new string(class_name) * self.scorer.metric = mteval.PyMetricInstance(self.scorer.name[0], # <<<<<<<<<<<<<< @@ -17657,7 +17712,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":185 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":185 * <void*> self, _compute_sufficient_stats, _compute_score) * * def __call__(self, refs): # <<<<<<<<<<<<<< @@ -17675,7 +17730,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_2__call__(struct __pyx_obj_4cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__call__", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":186 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":186 * * def __call__(self, refs): * return self.scorer(refs) # <<<<<<<<<<<<<< @@ -17719,7 +17774,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_5score(PyObject *__pyx_v_stats, C return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":188 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":188 * return self.scorer(refs) * * def score(SufficientStats stats): # <<<<<<<<<<<<<< @@ -17732,7 +17787,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_4score(CYTHON_UNUSED struct __pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("score", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":189 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":189 * * def score(SufficientStats stats): * return 0 # <<<<<<<<<<<<<< @@ -17810,7 +17865,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":191 +/* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":191 * return 0 * * def evaluate(self, hyp, refs): # <<<<<<<<<<<<<< @@ -17827,7 +17882,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("evaluate", 0); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":192 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":192 * * def evaluate(self, hyp, refs): * return [] # <<<<<<<<<<<<<< @@ -22366,6 +22421,10 @@ static void __pyx_tp_dealloc_4cdec_5_cdec_HypergraphNode(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } +static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_id(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_5_cdec_14HypergraphNode_2id_1__get__(o); +} + static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_in_edges(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_4cdec_5_cdec_14HypergraphNode_8in_edges_1__get__(o); } @@ -22387,6 +22446,7 @@ static PyMethodDef __pyx_methods_4cdec_5_cdec_HypergraphNode[] = { }; static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_HypergraphNode[] = { + {(char *)"id", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_id, 0, 0, 0}, {(char *)"in_edges", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_in_edges, 0, 0, 0}, {(char *)"out_edges", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_out_edges, 0, 0, 0}, {(char *)"span", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_span, 0, 0, 0}, @@ -25529,7 +25589,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":95 + /* "/home/pks/src/cdec-dtrain/python/cdec/vectors.pxi":95 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<< @@ -25540,7 +25600,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":6 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":6 * * def _phrase(phrase): * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<< @@ -25551,7 +25611,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":226 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":226 * trule = convert_rule(trule) * elif not isinstance(trule, TRule): * raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<< @@ -25561,7 +25621,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":244 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":244 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<< @@ -25572,16 +25632,16 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_19); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); - /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":281 + /* "/home/pks/src/cdec-dtrain/python/cdec/hypergraph.pxi":285 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<< */ - __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_20)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_20)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_21); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":26 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":26 * def __getitem__(self, int index): * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') # <<<<<<<<<<<<<< @@ -25592,7 +25652,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_24); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":39 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":39 * def __setitem__(self, int index, tuple arcs): * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') # <<<<<<<<<<<<<< @@ -25603,7 +25663,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_25); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":69 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":69 * for i in range(len(self)): * for label, weight, delta in self[i]: * yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) # <<<<<<<<<<<<<< @@ -25614,7 +25674,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_32); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":63 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":63 * def todot(self): * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" * def lines(): # <<<<<<<<<<<<<< @@ -25626,7 +25686,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); __pyx_k_codeobj_36 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_37, __pyx_n_s__lines, 63, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_36)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":72 + /* "/home/pks/src/cdec-dtrain/python/cdec/lattice.pxi":72 * yield '%d [shape=doublecircle]' % len(self) * yield '}' * return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<< @@ -25637,7 +25697,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_41); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":50 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":50 * def __getitem__(self, int index): * if not 0 <= index < len(self): * raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<< @@ -25648,7 +25708,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_43); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43)); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":84 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":84 * def __getitem__(self,int k): * if not 0 <= k < self.cs.size(): * raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<< @@ -25681,7 +25741,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_52); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52)); - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":5 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":5 * import cdec.sa._sa as _sa * * def _phrase(phrase): # <<<<<<<<<<<<<< @@ -25693,7 +25753,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56)); __pyx_k_codeobj_57 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_58, __pyx_n_s___phrase, 5, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_57)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":194 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":194 * return [] * * BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<< @@ -25704,7 +25764,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_59); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59)); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":195 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":195 * * BLEU = Scorer('IBM_BLEU') * QCRI = Scorer('QCRI_BLEU') # <<<<<<<<<<<<<< @@ -25715,7 +25775,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_60); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60)); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":196 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":196 * BLEU = Scorer('IBM_BLEU') * QCRI = Scorer('QCRI_BLEU') * TER = Scorer('TER') # <<<<<<<<<<<<<< @@ -25726,7 +25786,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_61); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61)); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":197 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":197 * QCRI = Scorer('QCRI_BLEU') * TER = Scorer('TER') * CER = Scorer('CER') # <<<<<<<<<<<<<< @@ -25736,7 +25796,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_62); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62)); - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":198 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":198 * TER = Scorer('TER') * CER = Scorer('CER') * SSK = Scorer('SSK') # <<<<<<<<<<<<<< @@ -26022,7 +26082,7 @@ PyMODINIT_FUNC PyInit__cdec(void) if (PyType_Ready(&__pyx_type_4cdec_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "SegmentEvaluator", (PyObject *)&__pyx_type_4cdec_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_4cdec_5_cdec_SegmentEvaluator = &__pyx_type_4cdec_5_cdec_SegmentEvaluator; - if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_16___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__; if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_25_genexpr = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_25_genexpr; @@ -26065,7 +26125,7 @@ PyMODINIT_FUNC PyInit__cdec(void) __pyx_ptype_4cdec_5_cdec_Decoder = &__pyx_type_4cdec_5_cdec_Decoder; if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_4cdec_5_cdec___pyx_scope_struct____iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__; - if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_17___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__; if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_18___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_18___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_18___iter__; @@ -26096,7 +26156,7 @@ PyMODINIT_FUNC PyInit__cdec(void) Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Execution code ---*/ - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":3 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":3 * cimport grammar * cimport cdec.sa._sa as _sa * import cdec.sa._sa as _sa # <<<<<<<<<<<<<< @@ -26114,7 +26174,7 @@ PyMODINIT_FUNC PyInit__cdec(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s___sa, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":5 + /* "/home/pks/src/cdec-dtrain/python/cdec/grammar.pxi":5 * import cdec.sa._sa as _sa * * def _phrase(phrase): # <<<<<<<<<<<<<< @@ -26126,7 +26186,7 @@ PyMODINIT_FUNC PyInit__cdec(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s___phrase, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":194 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":194 * return [] * * BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<< @@ -26138,7 +26198,7 @@ PyMODINIT_FUNC PyInit__cdec(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s__BLEU, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":195 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":195 * * BLEU = Scorer('IBM_BLEU') * QCRI = Scorer('QCRI_BLEU') # <<<<<<<<<<<<<< @@ -26150,7 +26210,7 @@ PyMODINIT_FUNC PyInit__cdec(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s__QCRI, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":196 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":196 * BLEU = Scorer('IBM_BLEU') * QCRI = Scorer('QCRI_BLEU') * TER = Scorer('TER') # <<<<<<<<<<<<<< @@ -26162,7 +26222,7 @@ PyMODINIT_FUNC PyInit__cdec(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s__TER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":197 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":197 * QCRI = Scorer('QCRI_BLEU') * TER = Scorer('TER') * CER = Scorer('CER') # <<<<<<<<<<<<<< @@ -26173,7 +26233,7 @@ PyMODINIT_FUNC PyInit__cdec(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s__CER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":198 + /* "/home/pks/src/cdec-dtrain/python/cdec/mteval.pxi":198 * TER = Scorer('TER') * CER = Scorer('CER') * SSK = Scorer('SSK') # <<<<<<<<<<<<<< diff --git a/python/cdec/hypergraph.pxi b/python/cdec/hypergraph.pxi index 4a709d32..91cc8eec 100644 --- a/python/cdec/hypergraph.pxi +++ b/python/cdec/hypergraph.pxi @@ -252,6 +252,10 @@ cdef class HypergraphNode: self.node = &hg.nodes_[i] return self + property id: + def __get__(self): + return self.node.id_ + property in_edges: def __get__(self): cdef unsigned i diff --git a/training/crf/mpi_adagrad_optimize.cc b/training/crf/mpi_adagrad_optimize.cc index 39bd763e..bac57324 100644 --- a/training/crf/mpi_adagrad_optimize.cc +++ b/training/crf/mpi_adagrad_optimize.cc @@ -157,11 +157,11 @@ struct TrainingObserver : public DecoderObserver { void GetGradient(SparseVector<double>* g) const { g->clear(); -#if HAVE_CXX11 +#if HAVE_CXX11 && (__GNUC_MINOR__ > 4 || __GNUC__ > 4) for (auto& gi : acc_grad) { #else for (FastSparseVector<prob_t>::const_iterator it = acc_grad.begin(); it != acc_grad.end(); ++it) { - pair<unsigned, double>& gi = *it; + const pair<unsigned, prob_t>& gi = *it; #endif g->set_value(gi.first, -gi.second.as_float()); } @@ -190,7 +190,7 @@ class AdaGradOptimizer { G() {} void update(const SparseVector<double>& g, vector<double>* x, SparseVector<double>* sx) { if (x->size() > G.size()) G.resize(x->size(), 0.0); -#if HAVE_CXX11 +#if HAVE_CXX11 && (__GNUC_MINOR__ > 4 || __GNUC__ > 4) for (auto& gi : g) { #else for (SparseVector<double>::const_iterator it = g.begin(); it != g.end(); ++it) { @@ -220,7 +220,7 @@ class AdaGradL1Optimizer { G.resize(x->size(), 0.0); u.resize(x->size(), 0.0); } -#if HAVE_CXX11 +#if HAVE_CXX11 && (__GNUC_MINOR__ > 4 || __GNUC__ > 4) for (auto& gi : g) { #else for (SparseVector<double>::const_iterator it = g.begin(); it != g.end(); ++it) { @@ -236,11 +236,11 @@ class AdaGradL1Optimizer { // compute updates (avoid invalidating iterators by putting them all // in the vector vupdate and applying them after this) vector<pair<unsigned, double>> vupdate; -#if HAVE_CXX11 +#if HAVE_CXX11 && (__GNUC_MINOR__ > 4 || __GNUC__ > 4) for (auto& xi : *sx) { #else - for (SparseVector<double>::const_iterator it = sx->begin(); it != sx->end(); ++it) { - const pair<unsigned,double>& gi = *it; + for (SparseVector<double>::iterator it = sx->begin(); it != sx->end(); ++it) { + const pair<unsigned,double>& xi = *it; #endif double z = fabs(u[xi.first] / t) - lambda; double s = 1; diff --git a/training/dtrain/dtrain.cc b/training/dtrain/dtrain.cc index 0a27a068..b01cf421 100644 --- a/training/dtrain/dtrain.cc +++ b/training/dtrain/dtrain.cc @@ -44,7 +44,7 @@ dtrain_init(int argc, char** argv, po::variables_map* cfg) ("pclr", po::value<string>()->default_value("no"), "use a (simple|adagrad) per-coordinate learning rate") ("batch", po::value<bool>()->zero_tokens(), "do batch optimization") ("repeat", po::value<unsigned>()->default_value(1), "repeat optimization over kbest list this number of times") - //("test-k-best", po::value<bool>()->zero_tokens(), "check if optimization works (use repeat >= 2)") + ("check", po::value<bool>()->zero_tokens(), "produce list of loss differentials") ("noup", po::value<bool>()->zero_tokens(), "do not update weights"); po::options_description cl("Command Line Options"); cl.add_options() @@ -130,8 +130,8 @@ main(int argc, char** argv) const score_t approx_bleu_d = cfg["approx_bleu_d"].as<score_t>(); const unsigned max_pairs = cfg["max_pairs"].as<unsigned>(); int repeat = cfg["repeat"].as<unsigned>(); - //bool test_k_best = false; - //if (cfg.count("test-k-best")) test_k_best = true; + bool check = false; + if (cfg.count("check")) check = true; weight_t loss_margin = cfg["loss_margin"].as<weight_t>(); bool batch = false; if (cfg.count("batch")) batch = true; @@ -412,27 +412,38 @@ main(int argc, char** argv) int cur_npairs = pairs.size(); npairs += cur_npairs; - score_t kbest_loss_first, kbest_loss_last = 0.0; + score_t kbest_loss_first = 0.0, kbest_loss_last = 0.0; + + if (check) repeat = 2; + vector<float> losses; // for check for (vector<pair<ScoredHyp,ScoredHyp> >::iterator it = pairs.begin(); it != pairs.end(); it++) { score_t model_diff = it->first.model - it->second.model; - kbest_loss_first += max(0.0, -1.0 * model_diff); + score_t loss = max(0.0, -1.0 * model_diff); + losses.push_back(loss); + kbest_loss_first += loss; } + score_t kbest_loss = 0.0; for (int ki=0; ki < repeat; ki++) { - score_t kbest_loss = 0.0; // test-k-best SparseVector<weight_t> lambdas_copy; // for l1 regularization SparseVector<weight_t> sum_up; // for pclr if (l1naive||l1clip||l1cumul) lambdas_copy = lambdas; + unsigned pair_idx = 0; // for check for (vector<pair<ScoredHyp,ScoredHyp> >::iterator it = pairs.begin(); it != pairs.end(); it++) { score_t model_diff = it->first.model - it->second.model; + score_t loss = max(0.0, -1.0 * model_diff); + + if (check && ki == 1) cout << losses[pair_idx] - loss << endl; + pair_idx++; + if (repeat > 1) { model_diff = lambdas.dot(it->first.f) - lambdas.dot(it->second.f); - kbest_loss += max(0.0, -1.0 * model_diff); + kbest_loss += loss; } bool rank_error = false; score_t margin; @@ -449,7 +460,7 @@ main(int argc, char** argv) if (rank_error || margin < loss_margin) { SparseVector<weight_t> diff_vec = it->first.f - it->second.f; if (batch) { - batch_loss += max(0., -1.0*model_diff); + batch_loss += max(0., -1.0 * model_diff); batch_updates += diff_vec; continue; } @@ -529,9 +540,8 @@ main(int argc, char** argv) if (ki==repeat-1) { // done kbest_loss_last = kbest_loss; if (repeat > 1) { - score_t best_score = -1.; score_t best_model = -std::numeric_limits<score_t>::max(); - unsigned best_idx; + unsigned best_idx = 0; for (unsigned i=0; i < samples->size(); i++) { score_t s = lambdas.dot((*samples)[i].f); if (s > best_model) { @@ -634,6 +644,8 @@ main(int argc, char** argv) Weights::WriteToFile(w_fn, decoder_weights, true); } + if (check) cout << "---" << endl; + } // outer loop if (average) w_average /= (weight_t)T; diff --git a/training/dtrain/dtrain.h b/training/dtrain/dtrain.h index ccb5ad4d..eb23b813 100644 --- a/training/dtrain/dtrain.h +++ b/training/dtrain/dtrain.h @@ -64,7 +64,7 @@ struct LocalScorer vector<score_t> w_; virtual score_t - Score(vector<WordID>& hyp, vector<WordID>& ref, const unsigned rank, const unsigned src_len)=0; + Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned rank, const unsigned src_len)=0; virtual void Reset() {} // only for ApproxBleuScorer, LinearBleuScorer diff --git a/training/dtrain/examples/standard/cdec.ini b/training/dtrain/examples/standard/cdec.ini index e1edc68d..6cba9e1e 100644 --- a/training/dtrain/examples/standard/cdec.ini +++ b/training/dtrain/examples/standard/cdec.ini @@ -21,6 +21,7 @@ feature_function=RuleIdentityFeatures feature_function=RuleSourceBigramFeatures feature_function=RuleTargetBigramFeatures feature_function=RuleShape +feature_function=RuleWordAlignmentFeatures #feature_function=SourceSpanSizeFeatures #feature_function=SourceWordPenalty #feature_function=SpanFeatures diff --git a/training/dtrain/examples/standard/dtrain.ini b/training/dtrain/examples/standard/dtrain.ini index fc83f08e..a515db02 100644 --- a/training/dtrain/examples/standard/dtrain.ini +++ b/training/dtrain/examples/standard/dtrain.ini @@ -2,7 +2,7 @@ #refs=./nc-wmt11.en.gz bitext=./nc-wmt11.gz output=- # a weights file (add .gz for gzip compression) or STDOUT '-' -select_weights=VOID # output average (over epochs) weight vector +select_weights=avg # output average (over epochs) weight vector decoder_config=./cdec.ini # config for cdec # weights for these features will be printed on each iteration print_weights=Glue WordPenalty LanguageModel LanguageModel_OOV PhraseModel_0 PhraseModel_1 PhraseModel_2 PhraseModel_3 PhraseModel_4 PhraseModel_5 PhraseModel_6 PassThrough diff --git a/training/dtrain/examples/standard/expected-output b/training/dtrain/examples/standard/expected-output index 75f47337..fa831221 100644 --- a/training/dtrain/examples/standard/expected-output +++ b/training/dtrain/examples/standard/expected-output @@ -4,7 +4,7 @@ Reading ./nc-wmt11.en.srilm.gz ----5---10---15---20---25---30---35---40---45---50---55---60---65---70---75---80---85---90---95--100 **************************************************************************************************** Example feature: Shape_S00000_T00000 -Seeding random number sequence to 3751911392 +Seeding random number sequence to 4138446869 dtrain Parameters: @@ -22,7 +22,7 @@ Parameters: pairs 'XYX' hi lo 0.1 pair threshold 0 - select weights 'VOID' + select weights 'avg' l1 reg 0 'none' pclr no max pairs 4294967295 @@ -36,87 +36,87 @@ Iteration #1 of 3. . 10 Stopping after 10 input sentences. WEIGHTS - Glue = -110 - WordPenalty = -8.2082 - LanguageModel = -319.91 - LanguageModel_OOV = -19.2 - PhraseModel_0 = +312.82 - PhraseModel_1 = -161.02 - PhraseModel_2 = -433.65 - PhraseModel_3 = +291.03 - PhraseModel_4 = +252.32 - PhraseModel_5 = +50.6 - PhraseModel_6 = +146.7 - PassThrough = -38.7 + Glue = -80.3 + WordPenalty = -51.247 + LanguageModel = +282.46 + LanguageModel_OOV = -85.8 + PhraseModel_0 = -100.06 + PhraseModel_1 = -98.692 + PhraseModel_2 = -9.4958 + PhraseModel_3 = +18.535 + PhraseModel_4 = +62.35 + PhraseModel_5 = +7 + PhraseModel_6 = +31.4 + PassThrough = -126.5 --- - 1best avg score: 0.16966 (+0.16966) - 1best avg model score: 29874 (+29874) - avg # pairs: 906.3 + 1best avg score: 0.25631 (+0.25631) + 1best avg model score: -4843.6 (-4843.6) + avg # pairs: 744.4 avg # rank err: 0 (meaningless) avg # margin viol: 0 k-best loss imp: 100% - non0 feature count: 832 + non0 feature count: 1274 avg list sz: 91.3 - avg f count: 139.77 -(time 0.35 min, 2.1 s/S) + avg f count: 143.72 +(time 0.4 min, 2.4 s/S) Iteration #2 of 3. . 10 WEIGHTS - Glue = -122.1 - WordPenalty = +83.689 - LanguageModel = +233.23 - LanguageModel_OOV = -145.1 - PhraseModel_0 = +150.72 - PhraseModel_1 = -272.84 - PhraseModel_2 = -418.36 - PhraseModel_3 = +181.63 - PhraseModel_4 = -289.47 - PhraseModel_5 = +140.3 - PhraseModel_6 = +3.5 - PassThrough = -109.7 + Glue = -117.4 + WordPenalty = -99.584 + LanguageModel = +395.05 + LanguageModel_OOV = -136.8 + PhraseModel_0 = +40.614 + PhraseModel_1 = -123.29 + PhraseModel_2 = -152 + PhraseModel_3 = -161.13 + PhraseModel_4 = -76.379 + PhraseModel_5 = +39.1 + PhraseModel_6 = +137.7 + PassThrough = -162.1 --- - 1best avg score: 0.17399 (+0.004325) - 1best avg model score: 4936.9 (-24937) - avg # pairs: 662.4 + 1best avg score: 0.26751 (+0.011198) + 1best avg model score: -10061 (-5216.9) + avg # pairs: 639.1 avg # rank err: 0 (meaningless) avg # margin viol: 0 k-best loss imp: 100% - non0 feature count: 1240 + non0 feature count: 1845 avg list sz: 91.3 - avg f count: 125.11 -(time 0.27 min, 1.6 s/S) + avg f count: 139.88 +(time 0.35 min, 2.1 s/S) Iteration #3 of 3. . 10 WEIGHTS - Glue = -157.4 - WordPenalty = -1.7372 - LanguageModel = +686.18 - LanguageModel_OOV = -399.7 - PhraseModel_0 = -39.876 - PhraseModel_1 = -341.96 - PhraseModel_2 = -318.67 - PhraseModel_3 = +105.08 - PhraseModel_4 = -290.27 - PhraseModel_5 = -48.6 - PhraseModel_6 = -43.6 - PassThrough = -298.5 + Glue = -101.1 + WordPenalty = -139.97 + LanguageModel = +327.98 + LanguageModel_OOV = -234.7 + PhraseModel_0 = -144.49 + PhraseModel_1 = -263.88 + PhraseModel_2 = -149.25 + PhraseModel_3 = -38.805 + PhraseModel_4 = +50.575 + PhraseModel_5 = -52.4 + PhraseModel_6 = +41.6 + PassThrough = -230.2 --- - 1best avg score: 0.30742 (+0.13343) - 1best avg model score: -15393 (-20329) - avg # pairs: 623.8 + 1best avg score: 0.36222 (+0.094717) + 1best avg model score: -17416 (-7355.5) + avg # pairs: 661.2 avg # rank err: 0 (meaningless) avg # margin viol: 0 k-best loss imp: 100% - non0 feature count: 1776 + non0 feature count: 2163 avg list sz: 91.3 - avg f count: 118.58 -(time 0.28 min, 1.7 s/S) + avg f count: 132.53 +(time 0.33 min, 2 s/S) Writing weights file to '-' ... done --- -Best iteration: 3 [SCORE 'fixed_stupid_bleu'=0.30742]. -This took 0.9 min. +Best iteration: 3 [SCORE 'fixed_stupid_bleu'=0.36222]. +This took 1.0833 min. diff --git a/training/dtrain/pairsampling.h b/training/dtrain/pairsampling.h index 3f67e209..1a3c498c 100644 --- a/training/dtrain/pairsampling.h +++ b/training/dtrain/pairsampling.h @@ -112,6 +112,7 @@ _PRO_cmp_pair_by_diff_d(pair<ScoredHyp,ScoredHyp> a, pair<ScoredHyp,ScoredHyp> b inline void PROsampling(vector<ScoredHyp>* s, vector<pair<ScoredHyp,ScoredHyp> >& training, score_t threshold, unsigned max, bool _unused=false, float _also_unused=0) { + sort(s->begin(), s->end(), cmp_hyp_by_score_d); unsigned max_count = 5000, count = 0, sz = s->size(); bool b = false; for (unsigned i = 0; i < sz-1; i++) { diff --git a/training/dtrain/score.cc b/training/dtrain/score.cc index 96d6e10a..127f34d2 100644 --- a/training/dtrain/score.cc +++ b/training/dtrain/score.cc @@ -32,7 +32,7 @@ BleuScorer::Bleu(NgramCounts& counts, const unsigned hyp_len, const unsigned ref } score_t -BleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, +BleuScorer::Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/) { unsigned hyp_len = hyp.size(), ref_len = ref.size(); @@ -52,7 +52,7 @@ BleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, * NOTE: 0 iff no 1gram match ('grounded') */ score_t -StupidBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, +StupidBleuScorer::Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/) { unsigned hyp_len = hyp.size(), ref_len = ref.size(); @@ -81,7 +81,7 @@ StupidBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, * (Nakov et al. '12) */ score_t -FixedStupidBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, +FixedStupidBleuScorer::Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/) { unsigned hyp_len = hyp.size(), ref_len = ref.size(); @@ -112,7 +112,7 @@ FixedStupidBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, * NOTE: max is 0.9375 (with N=4) */ score_t -SmoothBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, +SmoothBleuScorer::Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/) { unsigned hyp_len = hyp.size(), ref_len = ref.size(); @@ -143,7 +143,7 @@ SmoothBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, * sum up Ngram precisions */ score_t -SumBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, +SumBleuScorer::Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/) { unsigned hyp_len = hyp.size(), ref_len = ref.size(); @@ -167,7 +167,7 @@ SumBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, * sum up exp(Ngram precisions) */ score_t -SumExpBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, +SumExpBleuScorer::Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/) { unsigned hyp_len = hyp.size(), ref_len = ref.size(); @@ -191,7 +191,7 @@ SumExpBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, * sum up exp(weight * log(Ngram precisions)) */ score_t -SumWhateverBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, +SumWhateverBleuScorer::Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/) { unsigned hyp_len = hyp.size(), ref_len = ref.size(); @@ -224,7 +224,7 @@ SumWhateverBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, * No scaling by src len. */ score_t -ApproxBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, +ApproxBleuScorer::Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned rank, const unsigned src_len) { unsigned hyp_len = hyp.size(), ref_len = ref.size(); @@ -255,7 +255,7 @@ ApproxBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, * */ score_t -LinearBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref, +LinearBleuScorer::Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned rank, const unsigned /*src_len*/) { unsigned hyp_len = hyp.size(), ref_len = ref.size(); diff --git a/training/dtrain/score.h b/training/dtrain/score.h index 53e970ba..1cdd3fa9 100644 --- a/training/dtrain/score.h +++ b/training/dtrain/score.h @@ -138,43 +138,43 @@ make_ngram_counts(const vector<WordID>& hyp, const vector<WordID>& ref, const un struct BleuScorer : public LocalScorer { score_t Bleu(NgramCounts& counts, const unsigned hyp_len, const unsigned ref_len); - score_t Score(vector<WordID>& hyp, vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); + score_t Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); void Reset() {} }; struct StupidBleuScorer : public LocalScorer { - score_t Score(vector<WordID>& hyp, vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); + score_t Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); void Reset() {} }; struct FixedStupidBleuScorer : public LocalScorer { - score_t Score(vector<WordID>& hyp, vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); + score_t Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); void Reset() {} }; struct SmoothBleuScorer : public LocalScorer { - score_t Score(vector<WordID>& hyp, vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); + score_t Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); void Reset() {} }; struct SumBleuScorer : public LocalScorer { - score_t Score(vector<WordID>& hyp, vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); + score_t Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); void Reset() {} }; struct SumExpBleuScorer : public LocalScorer { - score_t Score(vector<WordID>& hyp, vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); + score_t Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); void Reset() {} }; struct SumWhateverBleuScorer : public LocalScorer { - score_t Score(vector<WordID>& hyp, vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); + score_t Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned /*rank*/, const unsigned /*src_len*/); void Reset() {}; }; @@ -194,7 +194,7 @@ struct ApproxBleuScorer : public BleuScorer glob_hyp_len_ = glob_ref_len_ = glob_src_len_ = 0.; } - score_t Score(vector<WordID>& hyp, vector<WordID>& ref, const unsigned rank, const unsigned src_len); + score_t Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned rank, const unsigned src_len); }; struct LinearBleuScorer : public BleuScorer @@ -207,7 +207,7 @@ struct LinearBleuScorer : public BleuScorer onebest_counts_.One(); } - score_t Score(vector<WordID>& hyp, vector<WordID>& ref, const unsigned rank, const unsigned /*src_len*/); + score_t Score(const vector<WordID>& hyp, const vector<WordID>& ref, const unsigned rank, const unsigned /*src_len*/); inline void Reset() { onebest_len_ = 1; |